Skip to content

Commit

Permalink
Merge pull request #361 from Shikkanime/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Ziedelth authored Apr 10, 2024
2 parents 0905893 + 383ac6b commit 10bc8c3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class AnimeToAnimeDtoConverter : AbstractConverter<Anime, AnimeDto>() {
slug = from.slug,
lastReleaseDateTime = from.lastReleaseDateTime.withUTC()
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME),
langTypes = animeService.getAllLangTypes(from)
langTypes = animeService.getAllLangTypes(from),
status = from.status,
)
}
}
2 changes: 2 additions & 0 deletions src/main/kotlin/fr/shikkanime/services/AnimeService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ class AnimeService : AbstractService<Anime, AnimeRepository>() {
)
}.toMutableSet()

entity.description = entity.description?.replace("\n", "")
?.replace("\r", "")
entity.status = StringUtils.getStatus(entity)
val savedEntity = super.save(entity)
val uuid = savedEntity.uuid!!
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/fr/shikkanime/services/EpisodeService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class EpisodeService : AbstractService<Episode, EpisodeRepository>() {
}

if (entity.anime != anime) {
anime.status = StringUtils.getStatus(anime)
entity.anime = animeService.update(anime)
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/fr/shikkanime/utils/StringUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ object StringUtils {
) = image.isNullOrBlank() ||
description.isNullOrBlank() ||
description.startsWith("(") ||
languageCacheService.detectLanguage(description) != countryCode.name.lowercase()
(description.isNotBlank() && languageCacheService.detectLanguage(description) != countryCode.name.lowercase())

fun getStatus(anime: Anime): Status {
val languageCacheService = Constant.injector.getInstance(LanguageCacheService::class.java)
Expand Down

0 comments on commit 10bc8c3

Please sign in to comment.