Skip to content

Commit

Permalink
fixed error exporting filtered data in CSV including files
Browse files Browse the repository at this point in the history
  • Loading branch information
SteRiccio committed Dec 19, 2024
1 parent eb3d56c commit 9ea6f09
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Objects } from '@openforis/arena-core'

import * as Survey from '@core/survey/survey'

import Job from '@server/job/job'
Expand All @@ -14,7 +16,7 @@ export default class FilesExportJob extends Job {
}

async execute() {
const { survey, cycle, includeDataFromAllCycles, recordUuids } = this.context
const { survey, cycle, fileNamesByFileUuid, includeDataFromAllCycles, recordUuids } = this.context

const { fileUuidsByCycle, total } = await SurveyRdbService.fetchEntitiesFileUuidsByCycle(
{
Expand All @@ -31,7 +33,10 @@ export default class FilesExportJob extends Job {
// write the files in subfolders by cycle
for await (const [cycle, fileUuids] of Object.entries(fileUuidsByCycle)) {
for await (const fileUuid of fileUuids) {
await this.writeFile({ fileUuid, cycle })
const exportedFileName = fileNamesByFileUuid[fileUuid]
if (Objects.isNotEmpty(exportedFileName)) {
await this.writeFile({ fileUuid, cycle })
}
this.incrementProcessedItems()
}
}
Expand Down

0 comments on commit 9ea6f09

Please sign in to comment.