Skip to content

Commit 9d0f6bf

Browse files
feat: add selectors for empty rubric and prompts
1 parent 65289dd commit 9d0f6bf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/data/services/lms/hooks/selectors.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export const useORAConfigData = (): types.ORAConfig => (
2121
data.useORAConfig().data
2222
);
2323

24+
export const usePrompts = () => useORAConfigData().prompts;
25+
2426
export const useSubmissionConfig = (): types.SubmissionConfig => (
2527
useORAConfigData().submissionConfig
2628
);
@@ -31,6 +33,24 @@ export const useAssessmentStepConfig = (): types.AssessmentStepConfig => (
3133

3234
export const useRubricConfig = (): types.RubricConfig => useORAConfigData().rubric;
3335

36+
export const useEmptyRubric = () => {
37+
const rubric = useRubricConfig();
38+
const out = {
39+
optionsSelected: rubric.criteria.reduce(
40+
(obj, curr) => ({ ...obj, [curr.name]: null }),
41+
{},
42+
),
43+
criterionFeedback: {},
44+
overallFeedback: '',
45+
};
46+
rubric.criteria.forEach(criterion => {
47+
if (criterion.feedbackEnabled) {
48+
out.criterionFeedback[criterion.name] = '';
49+
}
50+
});
51+
return out;
52+
};
53+
3454
export const useLeaderboardConfig = (): types.LeaderboardConfig => useORAConfigData().leaderboardConfig;
3555

3656
export const usePageDataStatus = () => {

0 commit comments

Comments
 (0)