diff --git a/build.gradle b/build.gradle index 2118d5d..48b262c 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ repositories { } dependencies { - implementation 'de.jottyfan:timetrackjooq:20240104b' + implementation 'de.jottyfan:timetrackjooq:20240105' implementation 'org.apache.logging.log4j:log4j-api:latest.release' implementation 'org.apache.logging.log4j:log4j-core:latest.release' diff --git a/src/main/java/de/jottyfan/timetrack/modules/done/DoneRepository.java b/src/main/java/de/jottyfan/timetrack/modules/done/DoneRepository.java index 5947bd2..c756974 100644 --- a/src/main/java/de/jottyfan/timetrack/modules/done/DoneRepository.java +++ b/src/main/java/de/jottyfan/timetrack/modules/done/DoneRepository.java @@ -23,6 +23,7 @@ import org.jooq.InsertOnDuplicateSetMoreStep; import org.jooq.InsertOnDuplicateStep; import org.jooq.Record1; import org.jooq.Record3; +import org.jooq.Record4; import org.jooq.Record5; import org.jooq.SelectConditionStep; import org.jooq.SelectHavingStep; @@ -160,11 +161,11 @@ public class DoneRepository { } public Map getSlots(LocalDate from, LocalDate until, String login) { - SelectSeekStep1, LocalDate> sql = jooq + SelectSeekStep1, LocalDate> sql = jooq // @formatter:off .select(T_REQUIRED_WORKTIME.PK_REQUIRED_WORKTIME, T_REQUIRED_WORKTIME.DAY, -// T_REQUIRED_WORKTIME.REASON, + T_REQUIRED_WORKTIME.REASON, T_REQUIRED_WORKTIME.REQUIRED_MINUTES) .from(T_REQUIRED_WORKTIME) .innerJoin(T_LOGIN).on(T_LOGIN.PK.eq(T_REQUIRED_WORKTIME.FK_LOGIN)) @@ -174,14 +175,14 @@ public class DoneRepository { .orderBy(T_REQUIRED_WORKTIME.DAY); // @formatter:on LOGGER.trace(sql); - Iterator> i = sql.fetch().iterator(); + Iterator> i = sql.fetch().iterator(); Map map = new HashMap<>(); while (i.hasNext()) { - Record3 n = i.next(); + Record4 n = i.next(); LocalDate day = n.get(T_REQUIRED_WORKTIME.DAY); Integer pk = n.get(T_REQUIRED_WORKTIME.PK_REQUIRED_WORKTIME); Integer minutes = n.get(T_REQUIRED_WORKTIME.REQUIRED_MINUTES); - String reason = null; // n.get(T_REQUIRED_WORKTIME.REASON); + String reason = n.get(T_REQUIRED_WORKTIME.REASON); map.put(day, SlotBean.of(pk, day, minutes, reason)); } return map; @@ -195,11 +196,11 @@ public class DoneRepository { * @return the slot or null */ public SlotBean getSlot(Integer id, String login) { - SelectConditionStep> sql = jooq + SelectConditionStep> sql = jooq // @formatter:off .select(T_REQUIRED_WORKTIME.PK_REQUIRED_WORKTIME, T_REQUIRED_WORKTIME.DAY, -// T_REQUIRED_WORKTIME.REASON, + T_REQUIRED_WORKTIME.REASON, T_REQUIRED_WORKTIME.REQUIRED_MINUTES) .from(T_REQUIRED_WORKTIME) .innerJoin(T_LOGIN).on(T_LOGIN.PK.eq(T_REQUIRED_WORKTIME.FK_LOGIN)) @@ -207,10 +208,10 @@ public class DoneRepository { .and(T_REQUIRED_WORKTIME.PK_REQUIRED_WORKTIME.eq(id)); // @formatter:on LOGGER.trace(sql); - Record3 r = sql.fetchOne(); + Record4 r = sql.fetchOne(); return r == null ? null : SlotBean.of(r.get(T_REQUIRED_WORKTIME.PK_REQUIRED_WORKTIME), r.get(T_REQUIRED_WORKTIME.DAY), - r.get(T_REQUIRED_WORKTIME.REQUIRED_MINUTES), null/*r.get(T_REQUIRED_WORKTIME.REASON)*/); + r.get(T_REQUIRED_WORKTIME.REQUIRED_MINUTES), r.get(T_REQUIRED_WORKTIME.REASON)); } public void addSlot(SlotBean bean, String login) { @@ -219,16 +220,16 @@ public class DoneRepository { .insertInto(T_REQUIRED_WORKTIME, T_REQUIRED_WORKTIME.DAY, T_REQUIRED_WORKTIME.REQUIRED_MINUTES, -// T_REQUIRED_WORKTIME.REASON, + T_REQUIRED_WORKTIME.REASON, T_REQUIRED_WORKTIME.FK_LOGIN) .select(jooq - .select(DSL.val(bean.getDay()), DSL.val(bean.getMinutes()), /* DSL.val(bean.getReason()), */ T_LOGIN.PK) + .select(DSL.val(bean.getDay()), DSL.val(bean.getMinutes()), DSL.val(bean.getReason()), T_LOGIN.PK) .from(T_LOGIN) .where(T_LOGIN.LOGIN.eq(login))) .onConflict(T_REQUIRED_WORKTIME.FK_LOGIN, T_REQUIRED_WORKTIME.DAY) .doUpdate() - .set(T_REQUIRED_WORKTIME.REQUIRED_MINUTES, bean.getMinutes()); -// .set(T_REQUIRED_WORKTIME.REASON, bean.getReason()); + .set(T_REQUIRED_WORKTIME.REQUIRED_MINUTES, bean.getMinutes()) + .set(T_REQUIRED_WORKTIME.REASON, bean.getReason()); // @formatter:off LOGGER.trace(sql); sql.execute(); @@ -239,7 +240,7 @@ public class DoneRepository { // @formatter:off .update(T_REQUIRED_WORKTIME) .set(T_REQUIRED_WORKTIME.REQUIRED_MINUTES, bean.getMinutes()) -// .set(T_REQUIRED_WORKTIME.REASON, bean.getReason()) + .set(T_REQUIRED_WORKTIME.REASON, bean.getReason()) .where(T_REQUIRED_WORKTIME.PK_REQUIRED_WORKTIME.eq(bean.getId())) .and(T_REQUIRED_WORKTIME.FK_LOGIN.in(jooq .select(T_LOGIN.PK) diff --git a/src/main/resources/templates/done/list.html b/src/main/resources/templates/done/list.html index e04ed5a..9627a4e 100644 --- a/src/main/resources/templates/done/list.html +++ b/src/main/resources/templates/done/list.html @@ -265,7 +265,7 @@ -  --:--