Skip to content

Commit

Permalink
fix: Juniors in importing timetable
Browse files Browse the repository at this point in the history
  • Loading branch information
1grzyb1 committed Mar 28, 2024
1 parent df3c034 commit c065119
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/main/kotlin/odyseja/odysejapka/gad/Team.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import odyseja.odysejapka.domain.Performance
import org.checkerframework.checker.lock.qual.LockHeld
import javax.persistence.Column

data class Team(
val performanceHour: String,
Expand All @@ -27,18 +25,26 @@ data class Team(
}

fun getAge(): String {
return code[3].toString()
val code = code[3].toString()
if (code == "J") {
return "0"
}
return code
}

fun getProblem(): String {
return code[1].toString()
val code = code[1].toString()
if (code == "J") {
return "0"
}
return code
}

fun getSpontanDay(): String {
if (day.lowercase().contains("sobota")) {
return "sobota"
return "niedziela"
}
return "niedziela"
return "sobota"
}

fun toPerformance(city: String): Performance {
Expand All @@ -52,7 +58,7 @@ data class Team(
performanceHour,
spontanHour,
part.toInt(),
day,
day.lowercase(),
getSpontanDay(),
league,
zspRow = zspRow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ImportTimetableService(
val jsonFactory = GsonFactory.getDefaultInstance()
val sheetsAdapter = ZspSheetsAdapter(credentials, jsonFactory, zspId)
val cityName = cityRepository.findFirstById(cityId).name
performanceService.deleteCity(cityId)
importer = TimeTableImporter(performanceService, sheetsAdapter, cityName)

job = Thread {
Expand Down

0 comments on commit c065119

Please sign in to comment.