generated from UniversityOfHelsinkiCS/toskaboiler
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1469 from UniversityOfHelsinkiCS/fix-grouping-que…
…stion fix: Grouping filter not working for grouping question
- Loading branch information
Showing
6 changed files
with
76 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Feedback, { FeedbackData } from 'models/feedback' | ||
import { FeedbackTarget, UserFeedbackTarget } from '../models' | ||
import { TEST_COURSE_REALISATION_ID } from './testIds' | ||
|
||
export const seedFeedbacks = async (feedbackDatas: FeedbackData[]) => { | ||
const fbt = await FeedbackTarget.findOne({ | ||
where: { | ||
courseRealisationId: TEST_COURSE_REALISATION_ID, | ||
}, | ||
include: [ | ||
{ | ||
model: UserFeedbackTarget, | ||
as: 'userFeedbackTargets', | ||
}, | ||
], | ||
}) | ||
|
||
await Promise.all( | ||
// @ts-expect-error fbt is any | ||
(fbt!.userFeedbackTargets as any[]).map(async (uft, idx) => { | ||
if (idx >= feedbackDatas.length) return | ||
const ftData = feedbackDatas[idx] | ||
const ft = await Feedback.create({ | ||
data: ftData, | ||
userId: uft.userId, | ||
degreeStudyRight: null, | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}) | ||
await uft.update({ feedbackId: ft.id }) | ||
}) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters