-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
127 additions
and
13 deletions.
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
server/src/main/kotlin/fi/oph/kitu/generated/model/YkiTutkintotarjonta.kt
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
server/src/main/kotlin/fi/oph/kitu/kielitesti/KielitestiRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package fi.oph.kitu.kielitesti | ||
|
||
import org.springframework.jdbc.core.simple.JdbcClient | ||
import org.springframework.stereotype.Repository | ||
import java.time.Instant | ||
|
||
data class KielitestiSuoritus( | ||
val id: Int?, | ||
val first_name: String, | ||
val last_name: String, | ||
val oppija_oid: String, | ||
val email: String, | ||
val time_completed: Instant, | ||
val luetun_ymmartaminen_result_system: Double, | ||
val luetun_ymmartaminen_result_teacher: Double, | ||
val kuullun_ymmartaminen_result_system: Double, | ||
val kuullun_ymmartaminen_result_teacher: Double, | ||
val puhe_result_system: Double, | ||
val puhe_result_teacher: Double, | ||
val kirjoittaminen_result_system: Double, | ||
val kirjottaminen_result_teacher: Double, | ||
val total_evaluation_teacher: String, | ||
val total_evaluation_system: String, | ||
) | ||
|
||
@Repository | ||
class KielitestiRepository( | ||
private val jdbcClient: JdbcClient, | ||
) { | ||
fun insertSuoritukset(suoritukset: List<KielitestiSuoritus>) { | ||
for (suoritus in suoritukset) { | ||
jdbcClient | ||
.sql( | ||
"""insert into koto_suoritus (first_name, last_name, oppija_oid, email, time_completed, luetun_ymmartaminen_result_system, luetun_ymmartaminen_result_teacher, kuullun_ymmartaminen_result_system, kuullun_ymmartaminen_result_teacher, puhe_result_system, puhe_result_teacher, kirjoittaminen_result_system, kirjottaminen_result_teacher, total_evaluation_teacher, total_evaluation_system) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", | ||
).paramSource(suoritus) | ||
.update() | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
server/src/main/kotlin/fi/oph/kitu/kielitesti/KielitestiScheduledTasks.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package fi.oph.kitu.kielitesti | ||
|
||
import com.github.kagkarlsson.scheduler.task.Task | ||
import com.github.kagkarlsson.scheduler.task.helper.Tasks | ||
import com.github.kagkarlsson.scheduler.task.schedule.Schedules | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@Configuration | ||
@ConditionalOnProperty(name = ["kitu.kielitesti.scheduling.enabled"], matchIfMissing = false) | ||
class KielitestiScheduledTasks { | ||
@Value("\${kitu.kielitesti.scheduling.import.schedule}") | ||
lateinit var kielitestiImportSchedule: String | ||
|
||
@Bean | ||
fun dailyImport(moodleService: MoodleService): Task<Void> = | ||
Tasks | ||
.recurring("Kielitesti-import", Schedules.parseSchedule(kielitestiImportSchedule)) | ||
.execute { _, _ -> moodleService.importSuoritukset() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters