fix: Synchro

release/mobdr-v0.0.1
Frédérik Benoist 2023-06-03 22:34:37 +02:00
parent 1ddc35136a
commit b27126cac2
3 changed files with 11 additions and 10 deletions

View File

@ -353,8 +353,8 @@ class ObjectBox {
});
}
Future<void> DeletePreviousVisitWithoutPhoto() async {
final visits = getPreviousVisit();
Future<void> DeleteVisitWithoutPhoto() async {
final visits = getAllVisit();
for (final visit in visits) {
final photoCount = getVisitPhotoCount(visit.id_visite);

View File

@ -206,6 +206,12 @@ class _SynchronizationPageState extends State<SynchronizationPage>
final ApiProvider _apiProvider = ApiProvider();
// upload photo to server
await _uploadVisitPhotos(_apiProvider);
// delete visits without a photo!
await objectbox.DeleteVisitWithoutPhoto();
// synchronous calendar synchronization
final syncCalendarResult = await _apiProvider.SyncCalendar();
@ -214,19 +220,14 @@ class _SynchronizationPageState extends State<SynchronizationPage>
_backofficeSyncCompleted = true;
}
// upload photo to server
await _uploadVisitPhotos(_apiProvider);
final syncLogResult = _syncLog ? await _apiProvider.SyncCalendar() : 'OK';
// synchronous logs synchronization
final syncLogResult = _syncLog ? await _apiProvider.SyncLog() : 'OK';
// log synchronization OK ?
if (syncLogResult == 'OK') {
_logSyncCompleted = true;
}
// delete visits without a photo!
await objectbox.DeletePreviousVisitWithoutPhoto();
// deletes photos that are no longer in any visits
await _cleanVisitPhotoDir();

View File

@ -174,7 +174,7 @@ class _VisitPhotoTypologyDetailPageState
//_shoppingCartCount++;
});
Fluttertoast.showToast(
msg: 'Item has been added to Shopping Cart',
msg: 'Item has been added to Shopping Card',
toastLength: Toast.LENGTH_LONG);
},
child: Container(