1 Commits

Author SHA1 Message Date
230581c3f5 preparing teacherage 2025-05-31 05:27:42 +02:00
4 changed files with 8 additions and 15 deletions

View File

@ -6,13 +6,6 @@
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/java">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/main" path="src/main/resources">
<attributes>
<attribute name="gradle_scope" value="main"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>camporganizer2</name>
<name>CampOrganizer2</name>
<comment></comment>
<projects>
</projects>

View File

@ -8,7 +8,7 @@ plugins {
}
group = 'de.jottyfan.camporganizer'
version = '0.9.4'
version = '0.9.5'
description = """CampOrganizer2"""
@ -41,7 +41,7 @@ war {
dependencies {
implementation 'org.jooq:jooq:3.19.14'
implementation 'de.jottyfan:COJooq:2024.10.24'
implementation 'de.jottyfan:COJooq:2025.04.23'
implementation 'org.apache.logging.log4j:log4j-api:2.24.1'
implementation 'org.apache.logging.log4j:log4j-core:2.24.1'

View File

@ -408,14 +408,14 @@ public class RegistrationRepository {
if (EnumCamprole.teacher.equals(campRole)) {
SelectConditionStep<Record2<Integer, DayToSecond>> sql = jooq
// @formatter:off
.select(T_CAMP.MAX_AGE,
DSL.localDateTimeDiff(T_CAMP.DEPART, birthDateDay).as("teacherAge"))
.from(T_CAMP)
.where(T_CAMP.PK.eq(fkCamp));
.select(V_CAMP.MIN_TEACHERAGE,
DSL.localDateTimeDiff(V_CAMP.DEPART, birthDateDay).as("teacherAge"))
.from(V_CAMP)
.where(V_CAMP.PK.eq(fkCamp));
// @formatter:on
LOGGER.trace(sql.toString());
Record r = sql.fetchOne();
Integer minTeacherAge = r.get(T_CAMP.MAX_AGE) + 2; // by default, we need 2 years older teachers at least
Integer minTeacherAge = r.get(V_CAMP.MIN_TEACHERAGE);
DayToSecond currentTeacherAge = r.get("teacherAge", DayToSecond.class);
double totalYears = currentTeacherAge.getTotalDays() / 365.25; // in years
int years = (int) totalYears;