@@ -108,6 +108,9 @@ public TimeClock updateTimeClock(UserId userId, TimeClockUpdate timeClockUpdate)
108
108
109
109
final TimeClockEntity timeClockEntity = toEntity (timeClock );
110
110
111
+ LOG .info ("Updating TimeClock for user {}" , userId .value ());
112
+ LOG .debug ("Next TimeClock: {}" , timeClock );
113
+
111
114
return toTimeClock (timeClockRepository .save (timeClockEntity ));
112
115
}
113
116
@@ -121,14 +124,16 @@ void stopTimeClock(UserId userId) {
121
124
.map (entity -> timeClockEntityWithStoppedAt (entity , ZonedDateTime .now (userSettingsProvider .zoneId ())))
122
125
.map (timeClockRepository ::save )
123
126
.map (TimeClockService ::toTimeClock )
124
- .ifPresent (timeClock -> {
125
-
126
- final ZonedDateTime start = timeClock .startedAt ();
127
- final ZonedDateTime end = timeClock .stoppedAt ()
128
- .orElseThrow (() -> new IllegalStateException ("expected stoppedAt to contain a value." ));
129
-
130
- timeEntryService .createTimeEntry (userId , timeClock .comment (), start , end , timeClock .isBreak ());
131
- });
127
+ .ifPresentOrElse (
128
+ timeClock -> {
129
+ final ZonedDateTime start = timeClock .startedAt ();
130
+ final ZonedDateTime end = timeClock .stoppedAt ()
131
+ .orElseThrow (() -> new IllegalStateException ("expected stoppedAt to contain a value." ));
132
+
133
+ LOG .info ("Stopping TimeClock={} for user={} and creating TimeEntry for it." , timeClock .id (), userId .value ());
134
+ timeEntryService .createTimeEntry (userId , timeClock .comment (), start , end , timeClock .isBreak ());
135
+ },
136
+ () -> LOG .info ("Not stopping TimeClock for user {} since nothing found. No TimeEntry created." , userId .value ()));
132
137
}
133
138
134
139
private static TimeClockEntity toEntity (TimeClock timeClock ) {
0 commit comments