solving problem adding checkin time

This commit is contained in:
José Salazar
2026-02-02 20:45:12 +09:00
parent d951b0a95d
commit 818fc1759a
13 changed files with 20113 additions and 20003 deletions

View File

@@ -215,13 +215,31 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
app ??= (await _getTodaysApplications(staffId))
.firstWhere((a) => a.shiftId == shiftId);
await _dataConnect
.updateApplicationStatus(
id: app.id,
roleId: app.shiftRole.id,
)
.checkInTime(_fromDateTime(DateTime.now()))
.execute();
final Timestamp checkInTs = _fromDateTime(DateTime.now());
print(
'ClockIn request: appId=${app.id} shiftId=$shiftId '
'checkInTime=${checkInTs.toJson()}',
);
try {
await _dataConnect
.updateApplicationStatus(
id: app.id,
)
.checkInTime(checkInTs)
.execute();
} catch (e) {
print('ClockIn updateApplicationStatus error: $e');
print('ClockIn error type: ${e.runtimeType}');
try {
final dynamic err = e;
final dynamic details =
err.details ?? err.response ?? err.data ?? err.message;
if (details != null) {
print('ClockIn error details: $details');
}
} catch (_) {}
rethrow;
}
return getAttendanceStatus();
}
@@ -236,10 +254,10 @@ class ClockInRepositoryImpl implements ClockInRepositoryInterface {
_getActiveApplication(apps);
if (app == null) throw Exception('No active shift found to clock out');
await _dataConnect.updateApplicationStatus(
id: app.id,
roleId: app.shiftRole.id,
)
await _dataConnect
.updateApplicationStatus(
id: app.id,
)
.status(dc.ApplicationStatus.CHECKED_OUT)
.checkOutTime(_fromDateTime(DateTime.now()))
.execute();