Skip to content

Commit

Permalink
Fix based on PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
severij committed Sep 18, 2024
1 parent ec4b7c0 commit c0fe972
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/oph/heratepalvelu/tep/kestojenUudelleenlaskentaHandler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"Handler työpaikkajaksojen kestojen uudelleenlaskentaa varten."
(:require [clojure.tools.logging :as log]
[environ.core :refer [env]]
[medley.core :refer [find-first]]
[oph.heratepalvelu.db.dynamodb :as ddb]
[oph.heratepalvelu.log.caller-log :refer
[log-caller-details-scheduled]]
Expand Down Expand Up @@ -37,12 +38,18 @@
(log/info "Processing" (count jaksot) "jaksoa.")
(doseq [jakso jaksot]
(let [concurrent-jaksot (nh/get-concurrent-jaksot-from-ehoks! [jakso])
opiskeluoikeudet (nh/get-and-memoize-opiskeluoikeudet!
concurrent-jaksot)
kestot (nh/oppijan-jaksojen-kestot
concurrent-jaksot opiskeluoikeudet)
jakso-key (nh/ids jakso)]
(if-let [new-kesto (get kestot jakso-key 0)]
jakso-key (nh/ids jakso)
new-kesto
(if (find-first #(= (:hankkimistapa_id %)
(:hankkimistapa_id jakso))
concurrent-jaksot)
(get (nh/oppijan-jaksojen-kestot
concurrent-jaksot
(nh/get-and-memoize-opiskeluoikeudet!
concurrent-jaksot))
jakso-key)
0)]
(if (some? new-kesto)
(do
(log/info "Updating jakso" jakso-key "with kesto" new-kesto)
(tc/update-jakso jakso
Expand Down

0 comments on commit c0fe972

Please sign in to comment.