Skip to content

Commit

Permalink
Integrated code lifecycle: Open repository for editors and instructor…
Browse files Browse the repository at this point in the history
…s during assessment (#9898)
  • Loading branch information
SimonEntholzer authored and AjayvirS committed Dec 3, 2024
1 parent bb37a79 commit 072f27d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,18 @@
</ng-template>
<ng-template #editorToolbar>
<ng-container *jhiExtensionPoint="overrideExportGoToRepository">
@if (isAtLeastEditor && localVCEnabled && !isTestRun) {
<a class="btn btn-secondary btn-sm me-2 open-repository-button" [routerLink]="localRepositoryLink" target="_blank" rel="noopener noreferrer">
<fa-icon [icon]="faExternalLink" />
<span jhiTranslate="artemisApp.exerciseAssessmentDashboard.programmingExercise.goToRepo"></span>
</a>
}
<jhi-programming-assessment-repo-export
[programmingExercises]="[exercise]"
[singleParticipantMode]="true"
[participationIdList]="participation ? [participation!.id!] : []"
/>
@if (!localVCEnabled) {
@if (isAtLeastEditor && !localVCEnabled) {
<a
class="ms-2 me-5"
href="{{ participation?.userIndependentRepositoryUri }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import { DiffMatchPatch } from 'diff-match-patch-typescript';
import { ProgrammingExerciseService } from 'app/exercises/programming/manage/services/programming-exercise.service';
import { TemplateProgrammingExerciseParticipation } from 'app/entities/participation/template-programming-exercise-participation.model';
import { getPositiveAndCappedTotalScore, getTotalMaxPoints } from 'app/exercises/shared/exercise/exercise.utils';
import { getExerciseDashboardLink, getLinkToSubmissionAssessment } from 'app/utils/navigation.utils';
import { getExerciseDashboardLink, getLinkToSubmissionAssessment, getLocalRepositoryLink } from 'app/utils/navigation.utils';
import { SubmissionType, getLatestSubmissionResult } from 'app/entities/submission.model';
import { isAllowedToModifyFeedback } from 'app/assessment/assessment.service';
import { breakCircularResultBackReferences } from 'app/exercises/shared/result/result.utils';
import { faTimesCircle } from '@fortawesome/free-solid-svg-icons';
import { faExternalLink, faTimesCircle } from '@fortawesome/free-solid-svg-icons';
import { cloneDeep } from 'lodash-es';
import { AssessmentAfterComplaint } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.component';
import { PROFILE_LOCALVC } from 'app/app.constants';
Expand Down Expand Up @@ -84,10 +84,12 @@ export class CodeEditorTutorAssessmentContainerComponent implements OnInit, OnDe
exerciseId: number;
exerciseGroupId: number;
exerciseDashboardLink: string[];
localRepositoryLink: string[];
loadingInitialSubmission = true;
highlightDifferences = false;

localVCEnabled = false;
isAtLeastEditor = false;

unreferencedFeedback: Feedback[] = [];
referencedFeedback: Feedback[] = [];
Expand All @@ -111,6 +113,7 @@ export class CodeEditorTutorAssessmentContainerComponent implements OnInit, OnDe

// Icons
faTimesCircle = faTimesCircle;
faExternalLink = faExternalLink;

/**
* Get all feedback suggestions without a reference. They will be shown in cards below the build output.
Expand Down Expand Up @@ -187,13 +190,15 @@ export class CodeEditorTutorAssessmentContainerComponent implements OnInit, OnDe
const programmingExercise = response.body!;
this.templateParticipation = programmingExercise.templateParticipation!;
this.exercise.gradingCriteria = programmingExercise.gradingCriteria;
this.isAtLeastEditor = !!this.exercise.isAtLeastEditor;
}),
switchMap(() => {
// Get all files with content from template repository
this.domainService.setDomain([DomainType.PARTICIPATION, this.templateParticipation]);
const observable = this.repositoryFileService.getFilesWithContent();
// Set back to student participation
this.domainService.setDomain([DomainType.PARTICIPATION, this.participation]);
this.localRepositoryLink = getLocalRepositoryLink(this.courseId, this.exerciseId, this.participation.id!, this.exerciseGroupId, this.examId);
return observable;
}),
tap((templateFilesObj) => {
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/app/utils/navigation.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ export const getExerciseDashboardLink = (courseId: number, exerciseId: number, e
: ['/course-management', courseId.toString(), 'assessment-dashboard', exerciseId.toString()];
};

export const getLocalRepositoryLink = (courseId: number, exerciseId: number, participationId: number, exerciseGroupId: number = 0, examId = 0): string[] => {
const suffix = ['programming-exercises', exerciseId.toString(), 'participations', participationId.toString(), 'repository'];

return examId < 0
? ['/course-management', courseId.toString(), 'exams', examId.toString(), 'exercise-groups', exerciseGroupId.toString(), ...suffix]
: ['/course-management', courseId.toString(), ...suffix];
};

/**
* A generic method which navigates into a subpage of an exam exercise
* @router the router th component uses to navigate into different webpages
Expand Down

0 comments on commit 072f27d

Please sign in to comment.