Merge branch '117-change-date-calculation-of-the-today-endpoint' into 'master'

Resolve "Change date calculation of the /today endpoint"

Closes #117

See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!91
This commit is contained in:
Marcel Schwarz 2020-05-31 21:36:03 +00:00
commit daf542c527
2 changed files with 7 additions and 2 deletions

View File

@ -45,7 +45,7 @@ public interface RecordRepository extends PagingAndSortingRepository<TimeRecord,
Pageable pageable
);
@Query("SELECT record from TimeRecord record where record.account.user.username = :#{principal} AND record.startdate > (current_date-1)")
@Query("SELECT record from TimeRecord record where record.account.user.username = :#{principal} AND record.enddate > current_date")
Page<TimeRecord> today(Pageable pageable);
@RestResource(rel = "openEntries", path = "openEntries")

View File

@ -29,6 +29,11 @@ INSERT INTO time_record (id, enddate, startdate, `type`, account_id) VALUES
(1, '2020-05-10 16:00:00', '2020-05-10 12:00:00', 0, 1),
(2, '2020-05-09 16:00:00', '2020-05-09 12:00:00', 1, 1),
(3, '2020-05-20 16:00:00', '2020-05-20 00:00:00', 1, 2),
(4, '2020-05-11 16:00:00', '2020-05-11 12:00:00', 1, 3);
(4, '2020-05-11 16:00:00', '2020-05-11 12:00:00', 1, 1),
(5, '2020-05-30 16:00:00', '2020-05-30 12:00:00', 1, 1),
(6, '2020-05-30 23:00:00', '2020-05-30 22:00:00', 1, 1),
(7, '2020-05-31 01:00:00', '2020-05-31 00:00:00', 1, 1),
(8, '2020-05-31 04:00:00', '2020-05-31 02:00:00', 1, 1),
(9, '2020-05-31 16:00:00', '2020-05-31 12:00:00', 1, 1);
SET FOREIGN_KEY_CHECKS=1;