repair river api and telegram issue
This commit is contained in:
parent
0d4d70cca6
commit
adb3cb0754
@ -170,13 +170,14 @@ class RiverInSituSamplingService {
|
|||||||
|
|
||||||
if (dataResult['success'] != true) {
|
if (dataResult['success'] != true) {
|
||||||
await _logAndSave(data: data, status: 'L1', message: dataResult['message']!, apiResults: [dataResult], ftpStatuses: [], serverName: serverName);
|
await _logAndSave(data: data, status: 'L1', message: dataResult['message']!, apiResults: [dataResult], ftpStatuses: [], serverName: serverName);
|
||||||
return {'success': false, 'message': dataResult['message']};
|
// FIX: Also return the status code for the UI
|
||||||
|
return {'status': 'L1', 'success': false, 'message': dataResult['message']};
|
||||||
}
|
}
|
||||||
|
|
||||||
final recordId = dataResult['data']?['r_man_id']?.toString();
|
final recordId = dataResult['data']?['r_man_id']?.toString();
|
||||||
if (recordId == null) {
|
if (recordId == null) {
|
||||||
await _logAndSave(data: data, status: 'L1', message: 'API Error: Missing record ID.', apiResults: [dataResult], ftpStatuses: [], serverName: serverName);
|
await _logAndSave(data: data, status: 'L1', message: 'API Error: Missing record ID.', apiResults: [dataResult], ftpStatuses: [], serverName: serverName);
|
||||||
return {'success': false, 'message': 'API Error: Missing record ID.'};
|
return {'status': 'L1', 'success': false, 'message': 'API Error: Missing record ID.'};
|
||||||
}
|
}
|
||||||
data.reportId = recordId;
|
data.reportId = recordId;
|
||||||
|
|
||||||
@ -252,7 +253,13 @@ class RiverInSituSamplingService {
|
|||||||
_handleSuccessAlert(data, appSettings, isDataOnly: !apiSuccess);
|
_handleSuccessAlert(data, appSettings, isDataOnly: !apiSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {'success': apiSuccess || ftpSuccess, 'message': finalMessage};
|
// FIX: Add the 'status' and 'reportId' keys to the return map for the UI.
|
||||||
|
return {
|
||||||
|
'status': finalStatus,
|
||||||
|
'success': apiSuccess || ftpSuccess,
|
||||||
|
'message': finalMessage,
|
||||||
|
'reportId': data.reportId
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _logAndSave({
|
Future<void> _logAndSave({
|
||||||
@ -279,7 +286,6 @@ class RiverInSituSamplingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleSuccessAlert(RiverInSituSamplingData data, List<Map<String, dynamic>>? appSettings, {required bool isDataOnly}) async {
|
Future<void> _handleSuccessAlert(RiverInSituSamplingData data, List<Map<String, dynamic>>? appSettings, {required bool isDataOnly}) async {
|
||||||
debugPrint("[DEBUG] appSettings passed to _handleSuccessAlert: ${jsonEncode(appSettings)}");
|
|
||||||
try {
|
try {
|
||||||
final submissionType = isDataOnly ? "(Data Only)" : "(Data & Images)";
|
final submissionType = isDataOnly ? "(Data Only)" : "(Data & Images)";
|
||||||
final stationName = data.selectedStation?['sampling_river'] ?? 'N/A';
|
final stationName = data.selectedStation?['sampling_river'] ?? 'N/A';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user