solving problem adding checkin time
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user