use start time from now rounded for favorites, too

This commit is contained in:
Jörg Henke
2023-11-08 17:06:24 +01:00
parent 8b51b595d6
commit 9373eacab7
3 changed files with 6 additions and 5 deletions

View File

@ -7,7 +7,7 @@ plugins {
apply plugin: 'io.spring.dependency-management'
group = 'de.jottyfan'
version = '1.4.1'
version = '1.4.2'
description = """timetrack"""

View File

@ -32,6 +32,7 @@ import org.jooq.SelectConditionStep;
import org.jooq.SelectLimitPercentStep;
import org.jooq.UpdateConditionStep;
import org.jooq.exception.DataAccessException;
import org.jooq.impl.DSL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@ -524,12 +525,12 @@ public class DoneGateway {
*
* @param fkFavorite the id of the favorite
*/
public void useFav(Integer fkFavorite) {
public void useFav(Integer fkFavorite, LocalDateTime startTime) {
InsertOnDuplicateStep<TDoneRecord> sql = getJooq()
// @formatter:off
.insertInto(T_DONE, T_DONE.FK_LOGIN, T_DONE.FK_PROJECT, T_DONE.FK_MODULE, T_DONE.FK_JOB, T_DONE.FK_BILLING)
.insertInto(T_DONE, T_DONE.FK_LOGIN, T_DONE.FK_PROJECT, T_DONE.FK_MODULE, T_DONE.FK_JOB, T_DONE.FK_BILLING, T_DONE.TIME_FROM)
.select(getJooq()
.select(T_FAVORITE.FK_LOGIN, T_FAVORITE.FK_PROJECT, T_FAVORITE.FK_MODULE, T_FAVORITE.FK_JOB, T_FAVORITE.FK_BILLING)
.select(T_FAVORITE.FK_LOGIN, T_FAVORITE.FK_PROJECT, T_FAVORITE.FK_MODULE, T_FAVORITE.FK_JOB, T_FAVORITE.FK_BILLING, DSL.val(startTime))
.from(T_FAVORITE)
.where(T_FAVORITE.PK_FAVORITE.eq(fkFavorite)));
// @formatter:on

View File

@ -222,7 +222,7 @@ public class DoneService {
public void usefavorite(Integer fkFavorite) {
try {
new DoneGateway(dsl).useFav(fkFavorite);
new DoneGateway(dsl).useFav(fkFavorite, timeService.roundTime(LocalDateTime.now(), INTERVAL));
} catch (Exception e) {
}
}