Skip to content

Commit

Permalink
fixup! Save a Single Question as csv
Browse files Browse the repository at this point in the history
Signed-off-by: hamza mahjoubi <hamzamahjoubi221@gmail.com>
  • Loading branch information
hamza221 committed Dec 9, 2023
1 parent f465264 commit 0917573
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@
'url' => '/api/{apiVersion}/submissions/exportQuestion/{questionId}',
'verb' => 'GET',
'requirements' => [
'apiVersion' => 'v2'
'apiVersion' => 'v2.2'
]
],
[
'name' => 'api#exportSubmission',
'url' => '/api/{apiVersion}/submissions/exportSubmission/{submissionId}',
'verb' => 'GET',
'requirements' => [
'apiVersion' => 'v2'
'apiVersion' => 'v2.2'
]
],
[
Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1121,8 +1121,8 @@ public function exportQuestion(int $questionId): DataDownloadResponse {
throw new OCSBadRequestException();
}

if ($form->getOwnerId() !== $this->currentUser->getUID()) {
$this->logger->debug('This form is not owned by the current user');
if (!$this->formsService->canSeeResults($form)) {
$this->logger->debug('The current user has no permission to get the results for this form');
throw new OCSForbiddenException();
}

Expand Down Expand Up @@ -1154,7 +1154,7 @@ public function exportSubmission(int $submissionId): DataDownloadResponse {
throw new OCSBadRequestException();
}

if (!$this->formsService->canSeeResults($form->id)) {
if (!$this->formsService->canSeeResults($form)) {
$this->logger->debug('The current user has no permission to get the results for this form');
throw new OCSForbiddenException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Results/ResultsSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default {
return textAnswers
},
questionDownload() {
return generateOcsUrl('apps/forms/api/v2/submissions/exportQuestion/{questionId}', { questionId: this.question.id })
return generateOcsUrl('apps/forms/api/v2.2/submissions/exportQuestion/{questionId}', { questionId: this.question.id })
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Results/Submission.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default {
computed: {
responseDownload() {
return generateOcsUrl('apps/forms/api/v2/submissions/exportSubmission/{submissionId}', { submissionId: this.submission.id })
return generateOcsUrl('apps/forms/api/v2.2/submissions/exportSubmission/{submissionId}', { submissionId: this.submission.id })
},
// Format submission-timestamp to DateTime
Expand Down
1 change: 0 additions & 1 deletion src/views/Results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ import PermissionTypes from '../mixins/PermissionTypes.js'
const picker = getFilePickerBuilder(t('forms', 'Save CSV to Files'))
.setMultiSelect(false)
.setModal(true)
.setType(1)
.allowDirectories()
.build()
Expand Down

0 comments on commit 0917573

Please sign in to comment.