Skip to content

Commit

Permalink
Merge pull request #9 from matheusfy/fix-genre-mapping
Browse files Browse the repository at this point in the history
fix genre mapping exception
  • Loading branch information
matheusfy authored May 14, 2024
2 parents 48adde5 + 59dc263 commit e864f2f
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ public Serie(SerieDTO serie){
this.titulo = serie.titulo();
this.ano = serie.ano();
this.duracao = serie.duracao();
this.categoria = Categoria.fromString(serie.genero().split(",")[0].trim());

for(String categoria: serie.genero().split(",")) {
try {
this.categoria = Categoria.fromString(categoria.trim());
break;
} catch (Exception error){
//TODO: Logar como warning para gerar uma tarefa para mapear a categoria. *nada critico*
System.out.println("Categoria não mapeada: " + categoria);
}
}

this.avaliacao = OptionalDouble.of(serie.avaliacao()).orElse(0.0);
this.votos = serie.votos();
this.rate = serie.rate();
Expand Down

0 comments on commit e864f2f

Please sign in to comment.