Skip to content

Commit

Permalink
Allow uploading monitorings in case of missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
onyxvd committed Oct 18, 2023
1 parent 07d703e commit 173fd6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,21 @@ open class UploadManager {
val monitoringDir = File(baseDir, monitoringCode)
var hasErrors = false

var fileObjects: Map<String, JsonObject>? = null
if (monitoringDir.exists() && monitoringDir.isDirectory) {
var fileObjects: Map<String, JsonObject>? = null

try {
fileObjects = uploadMonitoringFiles(monitoringDir.absolutePath, monitoringCode)
} catch (t: Throwable) {
hasErrors = true
}
} else {
errors.add(context.getString(R.string.sync_error_missing_files, monitoringCode))
}

if (!uploadMonitoringEntries(monitoringCode, fileObjects)) {
hasErrors = true
}
if (!uploadMonitoringEntries(monitoringCode, fileObjects)) {
hasErrors = true
}

if (hasErrors) {
Toast.makeText(
context, String.format(
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@
<string name="sync_error_details">"Детайли:"</string>
<string name="monitoring_common_observation_methodology">"Методика"</string>
<string name="sync_error_missing_image">"Липсващо изображение %s за %s"</string>
<string name="sync_error_missing_files">"Липсващи файлове за %s"</string>
<string name="quick_choice_button_empty">"---"</string>
<string name="nomenclatures_not_ready_title">"Внимание"</string>
<string name="nomenclatures_not_ready_message">"Номенлатурите на са заредени. Мола опитайте по-късно."</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ Do you really want to cancel the monitoring?"</string>
<string name="sync_error_details">"Details:"</string>
<string name="monitoring_common_observation_methodology">"Methodology"</string>
<string name="sync_error_missing_image">"Missing image %s for %s"</string>
<string name="sync_error_missing_files">"Missing files for %s"</string>
<string name="quick_choice_button_empty">"---"</string>
<string name="nomenclatures_not_ready_title">"Warning"</string>
<string name="nomenclatures_not_ready_message">"Nomenclatures are not loaded. Please try again later."</string>
Expand Down

0 comments on commit 173fd6c

Please sign in to comment.