fixed functionality

This commit is contained in:
Jörg Henke
2021-02-26 18:59:54 +01:00
committed by Jotty
parent a2d01b41e3
commit addf181933
12 changed files with 220 additions and 81 deletions

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

59
gradlew vendored
View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@ -28,16 +44,16 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
warn () {
echo "$*"
}
die ( ) {
die () {
echo
echo "$*"
echo
@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@ -138,35 +156,30 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save ( ) {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

22
gradlew.bat vendored
View File

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

View File

@ -7,6 +7,7 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.Map;
import de.jottyfan.timetrack.db.done.tables.records.TDoneRecord;
@ -31,7 +32,7 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
private TProjectRecord project;
private TModuleRecord module;
private TJobRecord activity;
private String wp;
private WpBean wp;
public DoneBean() {
}
@ -44,14 +45,24 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
this.project = projectMap.get(r.getFkProject());
this.module = moduleMap.get(r.getFkModule());
this.activity = jobMap.get(r.getFkJob());
this.wp = r.getWp();
List<WpBean> list = DoneGateway.getAllWps();
String key = r.getWp();
if (key != null && key.isBlank()) {
key = null;
}
if (key != null) {
for (WpBean bean : list) {
if (bean.getKey().equals(r.getWp())) {
this.wp = bean;
}
}
}
}
/**
* set the day of timeFrom and timeUntil, keeping the times
*
* @param day
* the day
* @param day the day
*/
public void setDay(Date day) {
if (timeFrom != null) {
@ -96,7 +107,8 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
* get local date time from s
*
* @param s the HH:mm formatted values
* @param ldt the date as basic for that datetime, for today one can use LocalDateTime.now(); in fact this is set if ldt is null internally
* @param ldt the date as basic for that datetime, for today one can use
* LocalDateTime.now(); in fact this is set if ldt is null internally
* @return the generated datetime
*/
public LocalDateTime getLocalDateTimeFromHHmm(String s, LocalDateTime ldt) {
@ -124,8 +136,8 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
public String getProjectNameWithWP() {
StringBuilder buf = new StringBuilder();
buf.append(project == null ? "" : project.getName());
if (wp != null && !wp.isBlank()) {
buf.append(" (").append(wp).append(")");
if (wp != null) {
buf.append(" (").append(wp.getKey()).append(")");
}
return buf.toString();
}
@ -142,6 +154,10 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
return activity == null ? "" : activity.getName();
}
public String getWpName() {
return wp == null ? "" : wp.getName();
}
public String getTimeFromString() {
return timeFrom == null ? "" : timeFrom.format(hhmm);
}
@ -209,14 +225,14 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
/**
* @return the wp
*/
public String getWp() {
public WpBean getWp() {
return wp;
}
/**
* @param wp the wp to set
*/
public void setWp(String wp) {
public void setWp(WpBean wp) {
this.wp = wp;
}
}

View File

@ -9,6 +9,8 @@ import static de.jottyfan.timetrack.db.done.Tables.V_TOTALOFDAY;
import static de.jottyfan.timetrack.db.done.Tables.V_WORKTIME;
import static de.jottyfan.timetrack.db.profile.Tables.T_LOGIN;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@ -151,8 +153,7 @@ public class DoneGateway extends JooqGateway {
/**
* get all from t_done of the given day
*
* @param day
* the day; if null, the current date is used
* @param day the day; if null, the current date is used
*
* @return a list of found times, an empty one at least
* @throws SQLException
@ -202,6 +203,7 @@ public class DoneGateway extends JooqGateway {
Integer fkProject = bean.getProject() == null ? null : bean.getProject().getPk();
Integer fkModule = bean.getModule() == null ? null : bean.getModule().getPk();
Integer fkJob = bean.getActivity() == null ? null : bean.getActivity().getPk();
String wp = bean.getWp() == null ? null : bean.getWp().getKey();
Integer fkLogin = getFkLogin();
try (CloseableDSLContext jooq = getJooq()) {
@ -215,7 +217,7 @@ public class DoneGateway extends JooqGateway {
T_DONE.FK_JOB,
T_DONE.WP,
T_DONE.FK_LOGIN)
.values(bean.getTimeFrom(), bean.getTimeUntil(), fkProject, fkModule, fkJob, bean.getWp(), fkLogin);
.values(bean.getTimeFrom(), bean.getTimeUntil(), fkProject, fkModule, fkJob, wp, fkLogin);
// @formatter:on
LOGGER.debug(sql.toString());
sql.execute();
@ -231,6 +233,7 @@ public class DoneGateway extends JooqGateway {
*/
public void update(DoneBean bean) throws DataAccessException, ClassNotFoundException, SQLException {
try (CloseableDSLContext jooq = getJooq()) {
String wp = bean.getWp() == null ? null : bean.getWp().getKey();
UpdateConditionStep<TDoneRecord> sql = jooq
// @formatter:off
.update(T_DONE)
@ -239,7 +242,7 @@ public class DoneGateway extends JooqGateway {
.set(T_DONE.FK_PROJECT, bean.getProject() == null ? null : bean.getProject().getPk())
.set(T_DONE.FK_JOB, bean.getActivity() == null ? null : bean.getActivity().getPk())
.set(T_DONE.FK_MODULE, bean.getModule() == null ? null : bean.getModule().getPk())
.set(T_DONE.WP, bean.getWp())
.set(T_DONE.WP, wp)
.where(T_DONE.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug(sql.toString());
@ -265,14 +268,14 @@ public class DoneGateway extends JooqGateway {
/**
* get day summary
*
* @param day
* the day
* @param day the day
* @return the day summary if found, an empty map otherwise
* @throws SQLException
* @throws ClassNotFoundException
* @throws DataAccessException
*/
public WholeDaySummaryBean getDaySummary(java.util.Date day) throws DataAccessException, ClassNotFoundException, SQLException {
public WholeDaySummaryBean getDaySummary(java.util.Date day)
throws DataAccessException, ClassNotFoundException, SQLException {
try (CloseableDSLContext jooq = getJooq()) {
SelectConditionStep<Record4<String, String, String, String>> sql = jooq
// @formatter:off
@ -300,14 +303,14 @@ public class DoneGateway extends JooqGateway {
/**
* get all jobs of day
*
* @param day
* the day
* @param day the day
* @return list of found jobs; an empty list at least
* @throws SQLException
* @throws ClassNotFoundException
* @throws DataAccessException
*/
public List<DailySummaryBean> getAllJobs(java.util.Date day) throws DataAccessException, ClassNotFoundException, SQLException {
public List<DailySummaryBean> getAllJobs(java.util.Date day)
throws DataAccessException, ClassNotFoundException, SQLException {
try (CloseableDSLContext jooq = getJooq()) {
SelectConditionStep<Record6<String, Double, String, String, String, String>> sql = jooq
// @formatter:off
@ -330,6 +333,7 @@ public class DoneGateway extends JooqGateway {
String moduleName = r.get(V_WORKTIME.MODULE_NAME);
String jobName = r.get(V_WORKTIME.JOB_NAME);
String wp = r.get(V_WORKTIME.WP);
durationHours = durationHours == null ? null : new BigDecimal(durationHours).setScale(2, RoundingMode.HALF_UP).doubleValue();
list.add(new DailySummaryBean(projectName, moduleName, jobName, duration, wp, durationHours));
}
return list;
@ -380,7 +384,8 @@ public class DoneGateway extends JooqGateway {
buf.append(": ");
buf.append(jobName);
FullCalendarEventBean bean = new FullCalendarEventBean(buf.toString(), java.util.Date.from(timeFrom.atZone(ZoneId.systemDefault()).toInstant())) {
FullCalendarEventBean bean = new FullCalendarEventBean(buf.toString(),
java.util.Date.from(timeFrom.atZone(ZoneId.systemDefault()).toInstant())) {
private static final long serialVersionUID = 1L;
@Override
@ -434,7 +439,8 @@ public class DoneGateway extends JooqGateway {
// @formatter:on
LOGGER.debug(sql.toString());
String sep = ";";
buf.append("day").append(sep).append("duration").append(sep).append("project").append(sep).append("module").append(sep).append("activity\n");
buf.append("day").append(sep).append("duration").append(sep).append("project").append(sep).append("module")
.append(sep).append("activity\n");
for (Record r : sql.fetch()) {
LocalDate workday = r.get(V_HAMSTERSUMMARY.WORKDAY);
String date = workday.format(DateTimeFormatter.ofPattern("dd.MM.yyyy"));
@ -447,4 +453,18 @@ public class DoneGateway extends JooqGateway {
}
return buf.toString();
}
/**
* dummy method to use until a table has been created
*
* @return all valid wps
*/
public static final List<WpBean> getAllWps() {
List<WpBean> list = new ArrayList<>();
list.add(new WpBean("WP2", "WP2 (eucs) - Opal/Mica/..., REST"));
list.add(new WpBean("WP4", "WP4 (eucs) - Square²"));
list.add(new WpBean("WP5", "WP5 (eucs) - SHIP-Datenbereitstellung"));
list.add(new WpBean("NFDI TA3", "TA3 (nfdi) - Mica Dev"));
return list;
}
}

View File

@ -41,6 +41,7 @@ public class DoneModel implements Model, Serializable {
private List<TProjectRecord> projects;
private List<TModuleRecord> modules;
private List<TJobRecord> activities;
private List<WpBean> wps;
private List<TimeBean> times;
private List<DailySummaryBean> allJobs;
private WholeDaySummaryBean daySummary;
@ -57,6 +58,7 @@ public class DoneModel implements Model, Serializable {
modules = gw.getAllModules();
activities = gw.getAllActivities();
projects = gw.getAllProjects();
wps = DoneGateway.getAllWps();
daySummary = gw.getDaySummary(day);
allJobs = gw.getAllJobs(day);
calendarEvents = gw.getAllCalendarEvents();
@ -244,6 +246,10 @@ public class DoneModel implements Model, Serializable {
return activities;
}
public List<WpBean> getWps() {
return wps;
}
public List<DailySummaryBean> getAllJobs() {
return allJobs;
}

View File

@ -0,0 +1,34 @@
package de.jottyfan.timetrack.modules.done;
import java.io.Serializable;
/**
*
* @author jotty
*
*/
public class WpBean implements Serializable {
private static final long serialVersionUID = 1L;
private final String name;
private final String key;
public WpBean(String key, String name) {
super();
this.key = key;
this.name = name;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @return the key
*/
public String getKey() {
return key;
}
}

View File

@ -45,7 +45,7 @@
<h:outputText value="Projekt" />
<h:outputText value="Modul" />
<h:outputText value="Tätigkeit" />
<h:outputText value="euCanShare WP" />
<h:outputText value="Abrechnung" />
<b:selectOneMenu id="project" value="#{doneModel.bean.project}">
<f:selectItem itemValue="" itemLabel="--- bitte wählen ---" />
<f:selectItems value="#{doneModel.projects}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
@ -59,10 +59,8 @@
<f:selectItems value="#{doneModel.activities}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
</b:selectOneMenu>
<b:selectOneMenu id="wp" value="#{doneModel.bean.wp}">
<f:selectItem itemValue="" itemLabel="---" />
<f:selectItem itemValue="WP2" itemLabel="WP2 - Opal/Mica/..., REST" />
<f:selectItem itemValue="WP4" itemLabel="WP4 - Square²" />
<f:selectItem itemValue="WP5" itemLabel="WP5 - SHIP-Datenbereitstellung" />
<f:selectItem itemValue="" itemLabel="--- bitte wählen ---" />
<f:selectItems value="#{doneModel.wps}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
</b:selectOneMenu>
</b:panelGrid>
<b:buttonGroup>

View File

@ -45,7 +45,7 @@
<h:outputText value="Projekt (#{doneModel.bean.projectName})" />
<h:outputText value="Modul (#{doneModel.bean.moduleName})" />
<h:outputText value="Tätigkeit (#{doneModel.bean.jobName})" />
<h:outputText value="euCanSHare WP" />
<h:outputText value="Abrechnung (#{doneModel.bean.wpName})" />
<b:selectOneMenu id="project" value="#{doneModel.bean.project}">
<f:selectItem itemValue="" itemLabel="--- bitte wählen ---" />
<f:selectItems value="#{doneModel.projects}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
@ -59,10 +59,8 @@
<f:selectItems value="#{doneModel.activities}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
</b:selectOneMenu>
<b:selectOneMenu id="wp" value="#{doneModel.bean.wp}">
<f:selectItem itemValue="" itemLabel="---" />
<f:selectItem itemValue="WP2" itemLabel="WP2 - Opal/Mica/..., REST" />
<f:selectItem itemValue="WP4" itemLabel="WP4 - Square²" />
<f:selectItem itemValue="WP5" itemLabel="WP5 - SHIP-Datenbereitstellung" />
<f:selectItem itemValue="" itemLabel="--- bitte wählen ---" />
<f:selectItems value="#{doneModel.wps}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
</b:selectOneMenu>
</b:panelGrid>
<b:buttonGroup>

View File

@ -79,7 +79,7 @@
</b:dataTableColumn>
<b:dataTableColumn label="" value="#{col.moduleName}" contentStyle="font-size: 120%" orderable="false" />
<b:dataTableColumn label="" value="#{col.jobName}" contentStyle="font-size: 120%" orderable="false" />
<b:dataTableColumn label="" value="#{col.duration} = #{col.durationHours} h" contentStyle="font-size: 120%" orderable="false" />
<b:dataTableColumn label="" value="#{col.durationHours} h" contentStyle="font-size: 120%" orderable="false" />
</b:dataTable>
</b:tab>
<b:tab title="Anhang">
@ -92,6 +92,27 @@
defaultDate="#{doneModel.dayIso8601}" defaultView="agendaDay" hidden="xs" scrollTime="08:00:00"
slotDuration="00:15:00" span="half" allDaySlot="false" lang="de" />
</b:tab>
<b:tab title="Projekt">
<ui:repeat value="#{doneModel.projects}" var="col">
<b:badge value="#{col.name}" class="prompt" />
</ui:repeat>
</b:tab>
<b:tab title="Modul">
<ui:repeat value="#{doneModel.modules}" var="col">
<b:badge value="#{col.name}" class="prompt" />
</ui:repeat>
</b:tab>
<b:tab title="Tätigkeit">
<ui:repeat value="#{doneModel.activities}" var="col">
<b:badge value="#{col.name}" class="prompt" />
</ui:repeat>
</b:tab>
<b:tab title="Abrechnung">
<b:dataTable value="#{doneModel.wps}" var="col" border="false" info="false">
<b:dataTableColumn label="Schlüssel" value="#{col.key}" />
<b:dataTableColumn label="Name" value="#{col.name}" />
</b:dataTable>
</b:tab>
</b:tabView>
</b:form>
</b:panel>

View File

@ -7,7 +7,7 @@
.page {
height: 100%;
width: 100%;
background-image: linear-gradient(to bottom, #fff 0%, #ccc 20%)
background-image: linear-gradient(to bottom, #ffffff 10%, #afffff 40%)
!important;
}
@ -68,6 +68,14 @@
text-align: right;
}
.prompt {
margin: 4px;
padding: 4px !important;
padding-bottom: 2px !important;
font-size: medium !important;
background-color: #005782 !important;
}
.version {
font-size: small;
color: silver;