Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive learning: Make exercise competencies management consistent #8064

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class FileUploadExerciseDetailComponent implements OnInit, OnDestroy {
const exercise = this.fileUploadExercise;
const generalSection = getExerciseGeneralDetailsSection(exercise);
const modeSection = getExerciseModeDetailSection(exercise);
const problemSection = getExerciseProblemDetailSection(this.formattedProblemStatement);
const problemSection = getExerciseProblemDetailSection(this.formattedProblemStatement, this.fileUploadExercise);
const solutionSection = getExerciseMarkdownSolution(exercise, this.formattedExampleSolution);
const defaultGradingDetails = getExerciseGradingDefaultDetails(exercise);
const gradingInstructionsCriteriaDetails = getExerciseGradingInstructionsCriteriaDetails(exercise, this.formattedGradingInstructions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ <h3 jhiTranslate="artemisApp.exercise.sections.problem" id="artemisApp.exercise.
[editorMode]="EditorMode.LATEX"
/>
</div>
@if (!isExamMode) {
<div class="form-group">
<jhi-competency-selection
id="competencies"
[labelName]="'artemisApp.competency.link.title' | artemisTranslate"
[labelTooltip]="'artemisApp.competency.link.exercise' | artemisTranslate"
[(ngModel)]="fileUploadExercise.competencies"
name="competencies"
/>
</div>
}
<h3 jhiTranslate="artemisApp.exercise.sections.solution" id="artemisApp.exercise.sections.solution">Example Solution</h3>
<!-- TODO we want to have a file upload here and store a PDF, not a text. We could allow to add text in the sample_solution_explanation field -->
<div class="form-group" id="field_exampleSolution">
Expand Down Expand Up @@ -207,17 +218,6 @@ <h3 jhiTranslate="artemisApp.exercise.sections.grading" id="artemisApp.exercise.
<input required minlength="2" type="text" class="form-control" name="filePattern" id="field_filePattern" [(ngModel)]="fileUploadExercise.filePattern" />
</div>
<jhi-presentation-score-checkbox [exercise]="fileUploadExercise" />
@if (!isExamMode) {
<div class="form-group">
<jhi-competency-selection
id="competencies"
[labelName]="'artemisApp.competency.link.title' | artemisTranslate"
[labelTooltip]="'artemisApp.competency.link.exercise' | artemisTranslate"
[(ngModel)]="fileUploadExercise.competencies"
name="competencies"
/>
</div>
}
<div class="form-group">
<label class="form-control-label" jhiTranslate="artemisApp.exercise.assessmentInstructions" for="gradingInstructions">Assessment Instructions</label>
<jhi-grading-instructions-details id="gradingInstructions" [exercise]="fileUploadExercise" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class ModelingExerciseDetailComponent implements OnInit, OnDestroy {
const exercise = this.modelingExercise;
const generalSection = getExerciseGeneralDetailsSection(exercise);
const modeSection = getExerciseModeDetailSection(exercise);
const problemSection = getExerciseProblemDetailSection(this.problemStatement);
const problemSection = getExerciseProblemDetailSection(this.problemStatement, this.modelingExercise);
const defaultGradingDetails = getExerciseGradingDefaultDetails(exercise);
const gradingInstructionsCriteriaDetails = getExerciseGradingInstructionsCriteriaDetails(exercise, this.gradingInstructions);
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ <h3 jhiTranslate="artemisApp.exercise.sections.problem" id="artemisApp.exercise.
[editorMode]="EditorMode.LATEX"
/>
</div>
@if (!isExamMode) {
<div class="form-group">
<jhi-competency-selection
id="competencies"
[labelName]="'artemisApp.competency.link.title' | artemisTranslate"
[labelTooltip]="'artemisApp.competency.link.exercise' | artemisTranslate"
[(ngModel)]="modelingExercise.competencies"
name="competencies"
/>
</div>
}
<h3 jhiTranslate="artemisApp.exercise.sections.solution" id="artemisApp.exercise.sections.solution">Example Solution</h3>
<div class="form-group">
<label class="form-control-label" jhiTranslate="artemisApp.modelingExercise.exampleSolution">Example Solution</label>
Expand Down Expand Up @@ -259,17 +270,6 @@ <h3 jhiTranslate="artemisApp.exercise.sections.grading" id="artemisApp.exercise.
<label class="form-control-label" jhiTranslate="artemisApp.exercise.assessmentInstructions" for="gradingInstructions">Assessment Instructions</label>
<jhi-grading-instructions-details id="gradingInstructions" [exercise]="modelingExercise" />
</div>
@if (!isExamMode) {
<div class="form-group">
<jhi-competency-selection
id="competencies"
[labelName]="'artemisApp.competency.link.title' | artemisTranslate"
[labelTooltip]="'artemisApp.competency.link.exercise' | artemisTranslate"
[(ngModel)]="modelingExercise.competencies"
name="competencies"
/>
</div>
}
<jhi-exercise-update-notification [exercise]="modelingExercise" [isImport]="isImport" [(notificationText)]="notificationText" />
</div>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { DetailOverviewSection, DetailType } from 'app/detail-overview-list/deta
import { IrisSettingsService } from 'app/iris/settings/shared/iris-settings.service';
import { IrisSubSettingsType } from 'app/entities/iris/settings/iris-sub-settings.model';
import { Detail } from 'app/detail-overview-list/detail.model';
import { Competency } from 'app/entities/competency.model';

@Component({
selector: 'jhi-programming-exercise-detail',
Expand All @@ -79,6 +80,7 @@ export class ProgrammingExerciseDetailComponent implements OnInit, OnDestroy {
readonly documentationType: DocumentationType = 'Programming';

programmingExercise: ProgrammingExercise;
competencies: Competency[];
isExamExercise: boolean;
supportsAuxiliaryRepositories: boolean;
baseResource: string;
Expand Down Expand Up @@ -157,6 +159,7 @@ export class ProgrammingExerciseDetailComponent implements OnInit, OnDestroy {

this.activatedRoute.data.subscribe(({ programmingExercise }) => {
this.programmingExercise = programmingExercise;
this.competencies = programmingExercise.competencies;
const exerciseId = this.programmingExercise.id!;
this.isExamExercise = !!this.programmingExercise.exerciseGroup;
this.courseId = this.isExamExercise ? this.programmingExercise.exerciseGroup!.exam!.course!.id! : this.programmingExercise.course!.id!;
Expand Down Expand Up @@ -446,14 +449,26 @@ export class ProgrammingExerciseDetailComponent implements OnInit, OnDestroy {
}

getExerciseDetailsProblemSection(exercise: ProgrammingExercise): DetailOverviewSection {
const hasCompetencies = !!this.competencies?.length;
const details: Detail[] = [
{
title: hasCompetencies ? 'artemisApp.programmingExercise.wizardMode.detailedSteps.problemStepTitle' : undefined,
type: DetailType.ProgrammingProblemStatement,
data: { exercise: exercise },
},
];

if (hasCompetencies) {
details.push({
title: 'artemisApp.competency.link.title',
type: DetailType.Text,
data: { text: this.competencies?.map((competency) => competency.title).join(', ') },
});
}

return {
headline: 'artemisApp.programmingExercise.wizardMode.detailedSteps.problemStepTitle',
details: [
{
type: DetailType.ProgrammingProblemStatement,
data: { exercise: exercise },
},
],
details: details,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ export class QuizExerciseDetailComponent implements OnInit {
const generalSection = getExerciseGeneralDetailsSection(exercise);
const modeSection = getExerciseModeDetailSection(exercise);
const defaultGradingDetails = getExerciseGradingDefaultDetails(exercise);

if (exercise.competencies?.length) {
modeSection.details.push({
title: 'artemisApp.competency.link.title',
type: DetailType.Text,
data: { text: exercise.competencies?.map((competency) => competency.title).join(', ') },
});
}
return [
generalSection,
{
Expand Down
25 changes: 18 additions & 7 deletions src/main/webapp/app/exercises/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,26 @@ export function getExerciseModeDetailSection(exercise: Exercise): DetailOverview
};
}

export function getExerciseProblemDetailSection(formattedProblemStatement: SafeHtml | null): DetailOverviewSection {
export function getExerciseProblemDetailSection(formattedProblemStatement: SafeHtml | null, exercise: Exercise): DetailOverviewSection {
const hasCompetencies = !!exercise.competencies?.length;
const details: Detail[] = [
{
title: hasCompetencies ? 'artemisApp.exercise.sections.problem' : undefined,
type: DetailType.Markdown,
data: { innerHtml: formattedProblemStatement },
},
];

if (hasCompetencies) {
details.push({
title: 'artemisApp.competency.link.title',
type: DetailType.Text,
data: { text: exercise.competencies?.map((competency) => competency.title).join(', ') },
});
}
return {
headline: 'artemisApp.exercise.sections.problem',
details: [
{
type: DetailType.Markdown,
data: { innerHtml: formattedProblemStatement },
},
],
details: details,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class TextExerciseDetailComponent implements OnInit, OnDestroy {
const exercise = this.textExercise;
const generalSection = getExerciseGeneralDetailsSection(exercise);
const modeSection = getExerciseModeDetailSection(exercise);
const problemSection = getExerciseProblemDetailSection(this.formattedProblemStatement);
const problemSection = getExerciseProblemDetailSection(this.formattedProblemStatement, this.textExercise);
const solutionSection = getExerciseMarkdownSolution(exercise, this.formattedExampleSolution);
const defaultGradingDetails = getExerciseGradingDefaultDetails(exercise);
const gradingInstructionsCriteriaDetails = getExerciseGradingInstructionsCriteriaDetails(exercise, this.formattedGradingInstructions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ <h3 jhiTranslate="artemisApp.exercise.sections.problem" id="artemisApp.exercise.
(markdownChange)="calculateFormSectionStatus()"
/>
</div>
@if (!isExamMode) {
<div class="form-group">
<jhi-competency-selection
id="competencies"
[labelName]="'artemisApp.competency.link.title' | artemisTranslate"
[labelTooltip]="'artemisApp.competency.link.exercise' | artemisTranslate"
[(ngModel)]="textExercise.competencies"
name="competencies"
/>
</div>
}
<h3 jhiTranslate="artemisApp.exercise.sections.solution" id="artemisApp.exercise.sections.solution">Example Solution</h3>
<div class="form-group">
<label jhiTranslate="artemisApp.exercise.exampleSolution" for="exampleSolution">Example Solution</label>
Expand Down Expand Up @@ -210,17 +221,6 @@ <h3 jhiTranslate="artemisApp.exercise.sections.grading" id="artemisApp.exercise.
<jhi-exercise-update-plagiarism [exercise]="textExercise" />
}
<jhi-presentation-score-checkbox [exercise]="textExercise" />
@if (!isExamMode) {
<div class="form-group">
<jhi-competency-selection
id="competencies"
[labelName]="'artemisApp.competency.link.title' | artemisTranslate"
[labelTooltip]="'artemisApp.competency.link.exercise' | artemisTranslate"
[(ngModel)]="textExercise.competencies"
name="competencies"
/>
</div>
}
<div class="form-group">
<label class="form-control-label" jhiTranslate="artemisApp.exercise.assessmentInstructions" for="gradingInstructions">Assessment Instructions</label>
<jhi-grading-instructions-details id="gradingInstructions" [exercise]="textExercise" />
Expand Down
Loading