Skip to content

Commit

Permalink
Merge pull request #428 from correctexam/427-proposition-for-a-generi…
Browse files Browse the repository at this point in the history
…c-marking-scheme

427 proposition for a generic marking scheme
  • Loading branch information
barais authored Dec 11, 2023
2 parents 5b59aad + d0af3f0 commit 9cc8d8d
Show file tree
Hide file tree
Showing 81 changed files with 4,822 additions and 159 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface IAnswer2HybridGradedComment {
id: number;
stepValue?: number | null;
hybridcommentsId?: number | null;
hybridcommentsText?: string | null;
studentResponseId?: number | null;
studentResponseText?: string | null;
}

export type NewAnswer2HybridGradedComment = Omit<IAnswer2HybridGradedComment, 'id'> & { id: null };
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { SharedModule } from 'app/shared/shared.module';
import { Answer2HybridGradedCommentComponent } from './list/answer-2-hybrid-graded-comment.component';
import { Answer2HybridGradedCommentDetailComponent } from './detail/answer-2-hybrid-graded-comment-detail.component';
import { Answer2HybridGradedCommentUpdateComponent } from './update/answer-2-hybrid-graded-comment-update.component';
import { Answer2HybridGradedCommentDeleteDialogComponent } from './delete/answer-2-hybrid-graded-comment-delete-dialog.component';
import { Answer2HybridGradedCommentRoutingModule } from './route/answer-2-hybrid-graded-comment-routing.module';

@NgModule({
imports: [SharedModule, Answer2HybridGradedCommentRoutingModule],
declarations: [
Answer2HybridGradedCommentComponent,
Answer2HybridGradedCommentDetailComponent,
Answer2HybridGradedCommentUpdateComponent,
Answer2HybridGradedCommentDeleteDialogComponent,
],
})
export class Answer2HybridGradedCommentModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { IAnswer2HybridGradedComment, NewAnswer2HybridGradedComment } from './answer-2-hybrid-graded-comment.model';

export const sampleWithRequiredData: IAnswer2HybridGradedComment = {
id: 41514,
};

export const sampleWithPartialData: IAnswer2HybridGradedComment = {
id: 66339,
stepValue: 63734,
};

export const sampleWithFullData: IAnswer2HybridGradedComment = {
id: 70396,
stepValue: 46287,
};

export const sampleWithNewData: NewAnswer2HybridGradedComment = {
id: null,
};

Object.freeze(sampleWithNewData);
Object.freeze(sampleWithRequiredData);
Object.freeze(sampleWithPartialData);
Object.freeze(sampleWithFullData);
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<form *ngIf="answer2HybridGradedComment" name="deleteForm" (ngSubmit)="confirmDelete(answer2HybridGradedComment.id!)">
<div class="modal-header">
<h4 class="modal-title" data-cy="answer2HybridGradedCommentDeleteDialogHeading" jhiTranslate="entity.delete.title">
Confirmation de suppression
</h4>

<button type="button" class="btn-close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">&times;</button>
</div>

<div class="modal-body">
<jhi-alert-error></jhi-alert-error>
<p
id="jhi-delete-answer2HybridGradedComment-heading"
jhiTranslate="gradeScopeIsticApp.answer2HybridGradedComment.delete.question"
[translateValues]="{ id: answer2HybridGradedComment.id }"
>
Êtes-vous certain de vouloir supprimer le Answer 2 Hybrid Graded Comment {{ answer2HybridGradedComment.id }} ?
</p>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()">
<fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Annuler</span>
</button>

<button id="jhi-confirm-delete-answer2HybridGradedComment" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger">
<fa-icon icon="times"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Supprimer</span>
</button>
</div>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
jest.mock('@ng-bootstrap/ng-bootstrap');

import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { of } from 'rxjs';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';

import { Answer2HybridGradedCommentService } from '../service/answer-2-hybrid-graded-comment.service';

import { Answer2HybridGradedCommentDeleteDialogComponent } from './answer-2-hybrid-graded-comment-delete-dialog.component';

describe('Answer2HybridGradedComment Management Delete Component', () => {
let comp: Answer2HybridGradedCommentDeleteDialogComponent;
let fixture: ComponentFixture<Answer2HybridGradedCommentDeleteDialogComponent>;
let service: Answer2HybridGradedCommentService;
let mockActiveModal: NgbActiveModal;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [Answer2HybridGradedCommentDeleteDialogComponent],
providers: [NgbActiveModal],
})
.overrideTemplate(Answer2HybridGradedCommentDeleteDialogComponent, '')
.compileComponents();
fixture = TestBed.createComponent(Answer2HybridGradedCommentDeleteDialogComponent);
comp = fixture.componentInstance;
service = TestBed.inject(Answer2HybridGradedCommentService);
mockActiveModal = TestBed.inject(NgbActiveModal);
});

describe('confirmDelete', () => {
it('Should call delete service on confirmDelete', inject(
[],
fakeAsync(() => {
// GIVEN
jest.spyOn(service, 'delete').mockReturnValue(of(new HttpResponse({ body: {} })));

// WHEN
comp.confirmDelete(123);
tick();

// THEN
expect(service.delete).toHaveBeenCalledWith(123);
expect(mockActiveModal.close).toHaveBeenCalledWith('deleted');
}),
));

it('Should not call delete service on clear', () => {
// GIVEN
jest.spyOn(service, 'delete');

// WHEN
comp.cancel();

// THEN
expect(service.delete).not.toHaveBeenCalled();
expect(mockActiveModal.close).not.toHaveBeenCalled();
expect(mockActiveModal.dismiss).toHaveBeenCalled();
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';

import { IAnswer2HybridGradedComment } from '../answer-2-hybrid-graded-comment.model';
import { Answer2HybridGradedCommentService } from '../service/answer-2-hybrid-graded-comment.service';
import { ITEM_DELETED_EVENT } from 'app/entities/hybrid-graded-comment/list/hybrid-graded-comment.component';

@Component({
templateUrl: './answer-2-hybrid-graded-comment-delete-dialog.component.html',
})
export class Answer2HybridGradedCommentDeleteDialogComponent {
answer2HybridGradedComment?: IAnswer2HybridGradedComment;

constructor(
protected answer2HybridGradedCommentService: Answer2HybridGradedCommentService,
protected activeModal: NgbActiveModal,
) {}

cancel(): void {
this.activeModal.dismiss();
}

confirmDelete(id: number): void {
this.answer2HybridGradedCommentService.delete(id).subscribe(() => {
this.activeModal.close(ITEM_DELETED_EVENT);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<div class="d-flex justify-content-center">
<div class="col-8">
<div *ngIf="answer2HybridGradedComment">
<h2 data-cy="answer2HybridGradedCommentDetailsHeading">
<span jhiTranslate="gradeScopeIsticApp.answer2HybridGradedComment.detail.title">Answer 2 Hybrid Graded Comment</span>
</h2>

<hr />

<jhi-alert-error></jhi-alert-error>

<jhi-alert></jhi-alert>

<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="global.field.id">ID</span></dt>
<dd>
<span>{{ answer2HybridGradedComment.id }}</span>
</dd>
<dt><span jhiTranslate="gradeScopeIsticApp.answer2HybridGradedComment.stepValue">Step Value</span></dt>
<dd>
<span>{{ answer2HybridGradedComment.stepValue }}</span>
</dd>
<dt><span jhiTranslate="gradeScopeIsticApp.answer2HybridGradedComment.hybridcomments">Hybridcomments</span></dt>
<dd>
<div *ngIf="answer2HybridGradedComment.hybridcommentsId">
<a [routerLink]="['/hybrid-graded-comment', answer2HybridGradedComment.hybridcommentsId, 'view']">{{
answer2HybridGradedComment.hybridcommentsText
}}</a>
</div>
</dd>
<dt><span jhiTranslate="gradeScopeIsticApp.answer2HybridGradedComment.studentResponse">Student Response</span></dt>
<dd>
<div *ngIf="answer2HybridGradedComment.studentResponseId">
<a [routerLink]="['/student-response', answer2HybridGradedComment.studentResponseId, 'view']">{{
answer2HybridGradedComment.studentResponseId
}}</a>
</div>
</dd>
</dl>

<button type="submit" (click)="previousState()" class="btn btn-info" data-cy="entityDetailsBackButton">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back">Retour</span>
</button>

<button
type="button"
[routerLink]="['/answer-2-hybrid-graded-comment', answer2HybridGradedComment.id, 'edit']"
class="btn btn-primary"
>
<fa-icon icon="pencil-alt"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit">Editer</span>
</button>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';
import { of } from 'rxjs';

import { Answer2HybridGradedCommentDetailComponent } from './answer-2-hybrid-graded-comment-detail.component';

describe('Answer2HybridGradedComment Management Detail Component', () => {
let comp: Answer2HybridGradedCommentDetailComponent;
let fixture: ComponentFixture<Answer2HybridGradedCommentDetailComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [Answer2HybridGradedCommentDetailComponent],
providers: [
{
provide: ActivatedRoute,
useValue: { data: of({ answer2HybridGradedComment: { id: 123 } }) },
},
],
})
.overrideTemplate(Answer2HybridGradedCommentDetailComponent, '')
.compileComponents();
fixture = TestBed.createComponent(Answer2HybridGradedCommentDetailComponent);
comp = fixture.componentInstance;
});

describe('OnInit', () => {
it('Should load answer2HybridGradedComment on init', () => {
// WHEN
comp.ngOnInit();

// THEN
expect(comp.answer2HybridGradedComment).toEqual(expect.objectContaining({ id: 123 }));
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

import { IAnswer2HybridGradedComment } from '../answer-2-hybrid-graded-comment.model';

@Component({
selector: 'jhi-answer-2-hybrid-graded-comment-detail',
templateUrl: './answer-2-hybrid-graded-comment-detail.component.html',
})
export class Answer2HybridGradedCommentDetailComponent implements OnInit {
answer2HybridGradedComment: IAnswer2HybridGradedComment | null = null;

constructor(protected activatedRoute: ActivatedRoute) {}

ngOnInit(): void {
this.activatedRoute.data.subscribe(({ answer2HybridGradedComment }) => {
this.answer2HybridGradedComment = answer2HybridGradedComment;
});
}

previousState(): void {
window.history.back();
}
}
Loading

0 comments on commit 9cc8d8d

Please sign in to comment.