Skip to content

Commit 02e12fe

Browse files
authored
show Part questions only
1 parent cc71651 commit 02e12fe

File tree

9 files changed

+131
-45
lines changed

9 files changed

+131
-45
lines changed

.github/workflows/build-images.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ jobs:
145145
run: |
146146
echo "🔍 SECRETS DETECTION SCAN"
147147
echo "========================"
148-
149-
pip install git+https://github.com/IBM/[email protected]+ibm.62.dss
148+
149+
pip install git+https://github.com/IBM/[email protected]+ibm.64.dss
150150
151151
# Run scan and show results
152152
echo "🔎 Scanning for potential secrets..."

apps/api/src/api/assignment/dto/update.questions.request.dto.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ export class ScoringDto {
9595
@Type(() => RubricDto)
9696
rubrics: RubricDto[];
9797

98+
@ApiProperty({
99+
description: "Show sub-questions to the learner",
100+
type: Boolean,
101+
})
102+
@IsBoolean()
103+
@IsOptional()
104+
showSubQuestionsToLearner?: boolean;
105+
98106
@ApiProperty({
99107
description: "Show rubric to the learner",
100108
type: Boolean,
@@ -688,6 +696,14 @@ export class AttemptScoringDto {
688696
@IsString()
689697
type: string;
690698

699+
@ApiPropertyOptional({
700+
description: "Whether sub-questions are shown to the learner",
701+
type: Boolean,
702+
})
703+
@IsOptional()
704+
@IsBoolean()
705+
showSubQuestionsToLearner?: boolean;
706+
691707
@ApiPropertyOptional({
692708
description: "Whether rubrics are shown to the learner",
693709
type: Boolean,

apps/web/app/author/(components)/(questionComponents)/QuestionWrapper.tsx

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ const PresentationOptions: FC<PresentationOptionsProps> = ({
261261
};
262262

263263
interface QuestionWrapperProps extends ComponentPropsWithoutRef<"div"> {
264+
showSubQuestionsToLearner?: boolean;
264265
showRubricsToLearner?: boolean;
265266
showPoints?: boolean;
266267
questionId: number;
@@ -291,6 +292,7 @@ interface QuestionWrapperProps extends ComponentPropsWithoutRef<"div"> {
291292
}
292293

293294
const QuestionWrapper: FC<QuestionWrapperProps> = ({
295+
showSubQuestionsToLearner,
294296
showRubricsToLearner,
295297
showPoints,
296298
questionId,
@@ -864,41 +866,79 @@ const QuestionWrapper: FC<QuestionWrapperProps> = ({
864866
Rubric
865867
</p>
866868
</div>
867-
{/* the section for 2 buttons */}
869+
{/* the section for 3 buttons */}
868870
<div className="flex lg:flex-row flex-col gap-2">
869871
<div className="flex items-center mr-4 gap-2 text-gray-600 text-nowrap">
870872
<span className="text-gray-600 typography-body">
871-
Show Rubrics to Learner
873+
Show Sub-Questions to Learner
872874
</span>
873875
<Tooltip
874-
content="Show rubrics to learners"
876+
content="Show sub-questions to learners"
875877
className="flex items-center"
876878
>
877879
<button
878880
type="button"
879881
onClick={() =>
880882
handleUpdateQuestionState({
881-
showRubricsToLearner: !showRubricsToLearner,
883+
showSubQuestionsToLearner: !showSubQuestionsToLearner,
882884
})
883885
}
884886
className={cn(
885887
"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none",
886-
showRubricsToLearner ? "bg-violet-600" : "bg-gray-200",
888+
showSubQuestionsToLearner ? "bg-violet-600" : "bg-gray-200",
887889
)}
888890
role="switch"
889-
aria-checked={showRubricsToLearner}
891+
aria-checked={showSubQuestionsToLearner}
890892
>
891893
<span
892894
aria-hidden="true"
893895
className={cn(
894896
"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",
895-
showRubricsToLearner ? "translate-x-5" : "translate-x-0",
897+
showSubQuestionsToLearner
898+
? "translate-x-5"
899+
: "translate-x-0",
896900
)}
897901
/>
898902
</button>
899903
</Tooltip>
900904
</div>
901-
{showRubricsToLearner && (
905+
{showSubQuestionsToLearner && (
906+
<div className="flex items-center mr-4 gap-2 text-gray-600 text-nowrap">
907+
<span className="text-gray-600 typography-body">
908+
Show Rubrics to Learner
909+
</span>
910+
<Tooltip
911+
content="Show rubrics to learners"
912+
className="flex items-center"
913+
>
914+
<button
915+
type="button"
916+
onClick={() =>
917+
handleUpdateQuestionState({
918+
showRubricsToLearner: !showRubricsToLearner,
919+
})
920+
}
921+
className={cn(
922+
"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none",
923+
showRubricsToLearner ? "bg-violet-600" : "bg-gray-200",
924+
)}
925+
role="switch"
926+
aria-checked={showRubricsToLearner}
927+
>
928+
<span
929+
aria-hidden="true"
930+
className={cn(
931+
"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",
932+
showRubricsToLearner
933+
? "translate-x-5"
934+
: "translate-x-0",
935+
)}
936+
/>
937+
</button>
938+
</Tooltip>
939+
</div>
940+
)}
941+
{showSubQuestionsToLearner && showRubricsToLearner && (
902942
<div className="flex items-center mr-4 gap-2 text-gray-600 text-nowrap">
903943
<span className="text-gray-600 typography-body">
904944
Display Rubric Points to Learners

apps/web/app/author/(components)/AuthorQuestionsPage/Question.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,18 @@ const Question: FC<QuestionProps> = ({
143143
params: UpdateQuestionStateParams,
144144
variantMode = false,
145145
) => {
146+
//if showSubQuestionsToLearner is undefined, use false as default
147+
const showSubQuestions =
148+
params.showSubQuestionsToLearner !== undefined
149+
? params.showSubQuestionsToLearner
150+
: (question.scoring?.showSubQuestionsToLearner ?? false);
151+
146152
//if showRubricsToLearner is undefined, use false as default
147-
const showRubrics =
148-
params.showRubricsToLearner !== undefined
153+
const showRubrics = showSubQuestions
154+
? params.showRubricsToLearner !== undefined
149155
? params.showRubricsToLearner
150-
: (question.scoring?.showRubricsToLearner ?? false);
156+
: (question.scoring?.showRubricsToLearner ?? false)
157+
: false;
151158

152159
//if showRubrics is false, showPoints uses false as default
153160
const showPoints = showRubrics
@@ -177,6 +184,7 @@ const Question: FC<QuestionProps> = ({
177184
updatedData.maxCharacters = params.maxCharacters;
178185
}
179186

187+
updatedData.scoring.showSubQuestionsToLearner = showSubQuestions;
180188
updatedData.scoring.showRubricsToLearner = showRubrics;
181189
updatedData.scoring.showPoints = showPoints;
182190

@@ -203,6 +211,7 @@ const Question: FC<QuestionProps> = ({
203211
params.randomizedChoices ?? question.randomizedChoices,
204212
scoring: {
205213
type: "CRITERIA_BASED",
214+
showSubQuestionsToLearner: showSubQuestions,
206215
showPoints: showPoints,
207216
showRubricsToLearner: showRubrics,
208217
rubrics: params.rubrics
@@ -1001,6 +1010,9 @@ const Question: FC<QuestionProps> = ({
10011010
questionFromParent={question}
10021011
variantMode={false}
10031012
responseType={question.responseType ?? ("OTHER" as const)}
1013+
showSubQuestionsToLearner={
1014+
question.scoring?.showSubQuestionsToLearner
1015+
}
10041016
showRubricsToLearner={question.scoring?.showRubricsToLearner}
10051017
showPoints={question.scoring?.showPoints}
10061018
/>

apps/web/app/learner/(components)/Question/LearnerRubricTable.tsx

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ interface SingleRubric {
1212

1313
interface LearnerRubricTableProps {
1414
rubrics: SingleRubric[];
15+
showRubrics: boolean;
1516
showPoints: boolean;
1617
}
1718

18-
function LearnerRubricTable({ rubrics, showPoints }: LearnerRubricTableProps) {
19+
function LearnerRubricTable({
20+
rubrics,
21+
showRubrics,
22+
showPoints,
23+
}: LearnerRubricTableProps) {
1924
if (!rubrics || rubrics.length === 0) return null;
2025

2126
return (
@@ -25,39 +30,41 @@ function LearnerRubricTable({ rubrics, showPoints }: LearnerRubricTableProps) {
2530
<h4 className="text-gray-700 text-md font-semibold">
2631
Sub Question {i + 1}: {rubric.rubricQuestion}
2732
</h4>
28-
<div className="overflow-x-auto">
29-
<table className="w-full text-left border border-gray-300 overflow-hidden">
30-
<thead className="bg-gray-100 border-b border-gray-300">
31-
<tr>
32-
<th className="p-2 text-gray-700 font-semibold">
33-
Description
34-
</th>
35-
{showPoints && (
36-
<th className="p-2 text-gray-700 font-semibold text-center">
37-
Points
33+
{showRubrics && (
34+
<div className="overflow-x-auto">
35+
<table className="w-full text-left border border-gray-300 overflow-hidden">
36+
<thead className="bg-gray-100 border-b border-gray-300">
37+
<tr>
38+
<th className="p-2 text-gray-700 font-semibold">
39+
Description
3840
</th>
39-
)}
40-
</tr>
41-
</thead>
42-
<tbody>
43-
{rubric.criteria.map((criterion, index) => (
44-
<tr
45-
key={index}
46-
className="border-b border-gray-300 last:border-0"
47-
>
48-
<td className="p-2 text-gray-600 max-w-sm text-wrap overflow-hidden">
49-
{criterion.description}
50-
</td>
5141
{showPoints && (
52-
<td className="p-2 text-gray-600 text-center">
53-
{criterion.points}
54-
</td>
42+
<th className="p-2 text-gray-700 font-semibold text-center">
43+
Points
44+
</th>
5545
)}
5646
</tr>
57-
))}
58-
</tbody>
59-
</table>
60-
</div>
47+
</thead>
48+
<tbody>
49+
{rubric.criteria.map((criterion, index) => (
50+
<tr
51+
key={index}
52+
className="border-b border-gray-300 last:border-0"
53+
>
54+
<td className="p-2 text-gray-600 max-w-sm text-wrap overflow-hidden">
55+
{criterion.description}
56+
</td>
57+
{showPoints && (
58+
<td className="p-2 text-gray-600 text-center">
59+
{criterion.points}
60+
</td>
61+
)}
62+
</tr>
63+
))}
64+
</tbody>
65+
</table>
66+
</div>
67+
)}
6168
</div>
6269
))}
6370
</div>

apps/web/app/learner/(components)/Question/QuestionContainer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ function Component(props: Props) {
6060
const checkToShowRubric = () => {
6161
if (
6262
["TEXT", "UPLOAD", "LINk_FILE", "URL"].includes(question.type) &&
63-
question.scoring.showRubricsToLearner &&
63+
question.scoring.showSubQuestionsToLearner &&
6464
question.scoring?.rubrics
6565
)
6666
return true;
6767
else return false;
6868
};
69+
const showRubrics = question.scoring?.showRubricsToLearner ?? false;
6970
const showPoints = question.scoring?.showPoints ?? false;
7071
// Get the questionStatus directly from the store
7172
const questionStatus = getQuestionStatusById
@@ -328,6 +329,7 @@ function Component(props: Props) {
328329
{checkToShowRubric() && (
329330
<ShowHideRubric
330331
rubrics={question.scoring.rubrics}
332+
showRubrics={showRubrics}
331333
showPoints={showPoints}
332334
/>
333335
)}

apps/web/app/learner/(components)/Question/ShowHideRubric.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ interface SingleRubric {
1414
interface ShowHideRubricProps {
1515
rubrics: SingleRubric[];
1616
className?: string;
17+
showRubrics: boolean;
1718
showPoints: boolean;
1819
}
1920

2021
function ShowHideRubric({
2122
rubrics,
2223
className,
24+
showRubrics,
2325
showPoints,
2426
}: ShowHideRubricProps) {
2527
const [showRubric, setShowRubric] = useState(false);
@@ -56,7 +58,11 @@ function ShowHideRubric({
5658
transition={{ duration: 0.3, ease: "easeInOut" }}
5759
className="overflow-hidden"
5860
>
59-
<LearnerRubricTable rubrics={rubrics} showPoints={showPoints} />
61+
<LearnerRubricTable
62+
rubrics={rubrics}
63+
showRubrics={showRubrics}
64+
showPoints={showPoints}
65+
/>
6066
</motion.div>
6167
)}
6268
</AnimatePresence>

apps/web/app/learner/[assignmentId]/successPage/Question.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ const Question: FC<Props> = ({
778778
<ShowHideRubric
779779
rubrics={scoring?.rubrics}
780780
className="mb-4"
781+
showRubrics={scoring?.showRubricsToLearner}
781782
showPoints={scoring?.showPoints}
782783
/>
783784
)}

apps/web/config/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ export type UpdateQuestionStateParams = {
235235
randomizedChoices?: boolean;
236236
maxWordCount?: number;
237237
questionTitle?: string;
238+
showSubQuestionsToLearner?: boolean;
238239
showRubricsToLearner?: boolean;
239240
//if the points will be shown in the rubric
240241
showPoints?: boolean;
@@ -358,6 +359,7 @@ export type Scoring = {
358359
type: "CRITERIA_BASED" | "LOSS_PER_MISTAKE" | "AI_GRADED";
359360
rubrics?: Rubric[];
360361
criteria?: Criteria[];
362+
showSubQuestionsToLearner?: boolean;
361363
showRubricsToLearner?: boolean;
362364
showPoints?: boolean;
363365
};

0 commit comments

Comments
 (0)