From a172ec0d707906b168e6eb8311529abbd5fb62f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Henke?= Date: Mon, 24 Nov 2025 11:25:09 +0100 Subject: [PATCH] enhanced favorites --- .classpath | 2 +- .settings/org.eclipse.jdt.core.prefs | 6 ++--- ....eclipse.wst.common.project.facet.core.xml | 2 +- build.gradle | 26 +++++++++---------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../timetrack/modules/done/DoneGateway.java | 20 ++++++++++---- .../modules/done/model/FavoriteBean.java | 17 +++++++++++- src/main/resources/templates/done/list.html | 7 ++++- src/main/resources/templates/layout/main.html | 14 +++++----- 9 files changed, 63 insertions(+), 33 deletions(-) diff --git a/.classpath b/.classpath index 7606e94..d7ed899 100644 --- a/.classpath +++ b/.classpath @@ -19,7 +19,7 @@ - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 8c9943d..92dd3c2 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.compliance=21 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -11,4 +11,4 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=17 +org.eclipse.jdt.core.compiler.source=21 diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 7859c6b..842a656 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -3,5 +3,5 @@ - + diff --git a/build.gradle b/build.gradle index 311572a..597fd87 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'org.springframework.boot' version '3.4.3' + id 'org.springframework.boot' version '3.5.0' id 'java' id 'war' } @@ -7,12 +7,12 @@ plugins { apply plugin: 'io.spring.dependency-management' group = 'de.jottyfan' -version = '1.5.7' +version = '1.5.8' description = """timetrack""" -sourceCompatibility = 17 -targetCompatibility = 17 +sourceCompatibility = 21 +targetCompatibility = 21 repositories { mavenLocal() @@ -25,24 +25,24 @@ repositories { dependencies { implementation 'de.jottyfan:timetrackjooq:20240109' - implementation 'org.apache.logging.log4j:log4j-api:2.24.3' - implementation 'org.apache.logging.log4j:log4j-core:2.24.3' - implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.24.3' + implementation 'org.apache.logging.log4j:log4j-api:2.25.2' + implementation 'org.apache.logging.log4j:log4j-core:2.25.2' + implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.25.2' - implementation 'org.webjars:bootstrap:5.3.3' - implementation 'org.webjars:font-awesome:6.7.2' + implementation 'org.webjars:bootstrap:5.3.8' + implementation 'org.webjars:font-awesome:7.0.1' implementation 'org.webjars:jquery:3.7.1' implementation 'org.webjars:popper.js:2.11.7' - implementation 'org.webjars:datatables:2.1.8' + implementation 'org.webjars:datatables:2.3.2' implementation 'org.webjars:jquery-ui:1.14.1' - implementation 'org.webjars:fullcalendar:6.1.9' + implementation 'org.webjars:fullcalendar:6.1.10' - implementation 'com.google.code.gson:gson:latest.release'; + implementation 'com.google.code.gson:gson'; implementation 'org.springframework.boot:spring-boot-starter-jooq' implementation 'org.springframework.boot:spring-boot-starter-security' implementation "org.springframework.boot:spring-boot-starter-oauth2-client" - implementation 'org.springframework.security:spring-security-oauth2-authorization-server:1.4.2' + implementation 'org.springframework.security:spring-security-oauth2-authorization-server' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-test' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2733ed5..3ae1e2f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/de/jottyfan/timetrack/modules/done/DoneGateway.java b/src/main/java/de/jottyfan/timetrack/modules/done/DoneGateway.java index e64ca25..cbee009 100644 --- a/src/main/java/de/jottyfan/timetrack/modules/done/DoneGateway.java +++ b/src/main/java/de/jottyfan/timetrack/modules/done/DoneGateway.java @@ -24,11 +24,13 @@ import org.jooq.DeleteConditionStep; import org.jooq.InsertOnDuplicateStep; import org.jooq.InsertReturningStep; import org.jooq.InsertValuesStep7; -import org.jooq.Record5; +import org.jooq.Name; +import org.jooq.Record6; import org.jooq.Record7; import org.jooq.Record8; import org.jooq.Result; import org.jooq.SelectConditionStep; +import org.jooq.SelectHavingStep; import org.jooq.SelectLimitPercentStep; import org.jooq.UpdateConditionStep; import org.jooq.exception.DataAccessException; @@ -493,31 +495,39 @@ public class DoneGateway { } public List getFavorites(Integer login) { - SelectConditionStep> sql = getJooq() + Name COUNT = DSL.name("cnt"); + SelectHavingStep> sql = getJooq() // @formatter:off .select(T_FAVORITE.PK_FAVORITE, V_PROJECT.NAME, V_MODULE.NAME, V_JOB.NAME, - V_BILLING.NAME) + V_BILLING.NAME, + DSL.count(T_DONE.PK).as(COUNT)) .from(T_FAVORITE) .leftJoin(V_PROJECT).on(V_PROJECT.PK.eq(T_FAVORITE.FK_PROJECT)) .leftJoin(V_MODULE).on(V_MODULE.PK.eq(T_FAVORITE.FK_MODULE)) .leftJoin(V_JOB).on(V_JOB.PK.eq(T_FAVORITE.FK_JOB)) .leftJoin(V_BILLING).on(V_BILLING.PK.eq(T_FAVORITE.FK_BILLING)) - .where(T_FAVORITE.FK_LOGIN.eq(login)); + .leftJoin(T_DONE).on(T_DONE.FK_PROJECT.eq(T_FAVORITE.FK_PROJECT)) + .and(T_DONE.FK_MODULE.eq(T_FAVORITE.FK_MODULE)) + .and(T_DONE.FK_JOB.eq(T_FAVORITE.FK_JOB)) + .where(T_FAVORITE.FK_LOGIN.eq(login)) + .groupBy(T_FAVORITE.PK_FAVORITE, V_PROJECT.NAME, V_MODULE.NAME, V_JOB.NAME, V_BILLING.NAME); // @formatter:on LOGGER.trace(sql); List list = new ArrayList<>(); - for (Record5 r : sql.fetch()) { + for (Record6 r : sql.fetch()) { FavoriteBean bean = new FavoriteBean(); bean.setFkFavorite(r.get(T_FAVORITE.PK_FAVORITE)); bean.setProject(r.get(V_PROJECT.NAME)); bean.setModule(r.get(V_MODULE.NAME)); bean.setJob(r.get(V_JOB.NAME)); bean.setBilling(r.get(V_BILLING.NAME)); + bean.setLoad(r.get(COUNT, Integer.class)); list.add(bean); } + list.sort((o1, o2) -> o1 != null && o1.getModule() != null && o2 != null ? o1.getModule().compareTo(o2.getModule()) : 0); return list; } diff --git a/src/main/java/de/jottyfan/timetrack/modules/done/model/FavoriteBean.java b/src/main/java/de/jottyfan/timetrack/modules/done/model/FavoriteBean.java index 7dcd78c..a0938b5 100644 --- a/src/main/java/de/jottyfan/timetrack/modules/done/model/FavoriteBean.java +++ b/src/main/java/de/jottyfan/timetrack/modules/done/model/FavoriteBean.java @@ -8,13 +8,14 @@ import java.io.Serializable; * */ public class FavoriteBean implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 2L; private Integer fkFavorite; private String project; private String module; private String job; private String billing; + private Integer load; /** * @return the project @@ -85,4 +86,18 @@ public class FavoriteBean implements Serializable { public void setFkFavorite(Integer fkFavorite) { this.fkFavorite = fkFavorite; } + + /** + * @return the load + */ + public Integer getLoad() { + return load; + } + + /** + * @param load the load to set + */ + public void setLoad(Integer load) { + this.load = load; + } } diff --git a/src/main/resources/templates/done/list.html b/src/main/resources/templates/done/list.html index 2419fbb..f50d3ea 100644 --- a/src/main/resources/templates/done/list.html +++ b/src/main/resources/templates/done/list.html @@ -101,7 +101,12 @@ diff --git a/src/main/resources/templates/layout/main.html b/src/main/resources/templates/layout/main.html index 107cb1a..ea97434 100644 --- a/src/main/resources/templates/layout/main.html +++ b/src/main/resources/templates/layout/main.html @@ -5,19 +5,19 @@ Timetrack - - - - + + + + - - - + + +