Skip to content

Commit e0dabba

Browse files
committed
Randomizing order of rows in the exported sheet
1 parent d7c0ef0 commit e0dabba

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/Exports/UsersSheets/AnonymousQuestionsExport.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ public function __construct(Semester $semester)
3131
*/
3232
public function collection(): \Illuminate\Support\Collection
3333
{
34-
return $this->semester->answerSheets;
34+
return $this->semester->answerSheets()
35+
->orderBy('year_of_acceptance')
36+
->inRandomOrder() // so that they cannot be tracked as easily
37+
->get();
3538
}
3639

3740
/**

app/Models/AnonymousQuestions/AnswerSheet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ public static function createForCurrentUser(Semester $semester = null): AnswerSh
8989
/**
9090
* Returns an array with the data associated with the sheet:
9191
* year of acceptance and then textual answers to the questions
92-
* in order of ascending id.
92+
* in order of their ids.
9393
* (For multiple-choice questions, the separators between the choices are commas.)
94+
* The id of the sheet is omitted for better pseudonomity.
9495
*/
9596
public function toArray(): array
9697
{
9798
$row = [
98-
$this->id,
9999
$this->semester->tag,
100100
$this->year_of_acceptance
101101
];

0 commit comments

Comments
 (0)