Skip to content

Commit

Permalink
001 for devops check (#2625)
Browse files Browse the repository at this point in the history
* 2508: fix and switch on job which clear unused pictures

* 2508: fix and switch on job which clear unused pictures

* 2590 fix version update

* refactor
delete extra code

---------

Co-authored-by: Elena Moshnikova <[email protected]>
Co-authored-by: Dmitriy Stoyanov <[email protected]>
  • Loading branch information
3 people authored Oct 26, 2024
1 parent a51faf3 commit 4b9cc62
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/kotlin/com/epam/brn/service/AudiometryHistoryService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ class AudiometryHistoryService(
val headphonesFromUser = getSpecificHeadphonesFromCurrentUser(currentUser.headphones, request.headphones)
val audiometryHistory = request.toEntity(currentUser, audiometryTask, headphonesFromUser)
val savedAudiometryHistory = audiometryHistoryRepository.save(audiometryHistory)
if (!request.sinAudiometryResults.isNullOrEmpty()) {
if (!request.sinAudiometryResults.isNullOrEmpty())
request.sinAudiometryResults!!.forEach { (frequency, sound) ->
sinAudiometryResultRepository.save(
SinAudiometryResult(frequency = frequency, soundLevel = sound, audiometryHistory = savedAudiometryHistory)
SinAudiometryResult(
frequency = frequency,
soundLevel = sound,
audiometryHistory = savedAudiometryHistory
)
)
}
}
return savedAudiometryHistory.id!!
}

private fun getSpecificHeadphonesFromCurrentUser(headphones: MutableSet<Headphones>, headphonesId: Long?) =
headphones.find() { entity ->
entity.id == headphonesId
} ?: throw IllegalArgumentException("Current user has ho headphones with id=$headphonesId")
headphones.find { entity -> entity.id == headphonesId }
?: throw IllegalArgumentException("Current user has ho headphones with id=$headphonesId")
}

0 comments on commit 4b9cc62

Please sign in to comment.