Skip to content

Commit

Permalink
Fix the CSV export to not build up and exclude unwanted fields (StepF…
Browse files Browse the repository at this point in the history
…ields)
  • Loading branch information
Simon Erkelens committed Jun 8, 2018
1 parent 28470d5 commit dc2e386
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/jobs/PartialSubmissionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,21 @@ protected function buildCSV($file, $form)
*/
protected function processSubmissions($form, $submissions, $resource)
{
$editableFields = $form->Fields()->map('Name', 'Title')->toArray();
$editableFields = $form
->Fields()
->exclude(['Name:PartialMatch' => 'EditableFormStep'])
->map('Name', 'Title')
->toArray();
$submitted = [];
foreach ($submissions as $submission) {
$submitted = [];
$values = $submission->PartialFields()->map('Name', 'Value')->toArray();
$i = 0;
foreach ($editableFields as $field => $title) {
$submitted[] = '';
if (isset($values[$field])) {
$submitted[] = $values[$field];
} else {
$submitted[] = '';
}
$i++;
}
Expand Down

0 comments on commit dc2e386

Please sign in to comment.