25-10-11/1
This commit is contained in:
@@ -428,18 +428,26 @@ class HomeCaptainController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> getCaptainDurationOnToday() async {
|
||||
var res = await CRUD().get(
|
||||
try {
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getTotalDriverDurationToday,
|
||||
payload: {'driver_id': box.read(BoxName.driverID).toString()});
|
||||
if (res == 'failure') {
|
||||
payload: {'driver_id': box.read(BoxName.driverID).toString()},
|
||||
);
|
||||
|
||||
if (res == null || res == 'failure') {
|
||||
totalDurationToday = '0';
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
var data = jsonDecode(res);
|
||||
totalDurationToday = data['message']?[0]?['total_duration'] ?? '0';
|
||||
} catch (e) {
|
||||
print('Error in getCaptainDurationOnToday: $e');
|
||||
totalDurationToday = '0';
|
||||
update();
|
||||
return;
|
||||
} else {
|
||||
data = jsonDecode(res);
|
||||
totalDurationToday = data['message'][0]['total_duration'];
|
||||
update();
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user