Skip to content

Commit

Permalink
Merge pull request #26 from dev-labs-bg/feature/exam
Browse files Browse the repository at this point in the history
Feature / Admin Assessments
  • Loading branch information
superKalo authored Dec 5, 2016
2 parents 0472af9 + b3fed51 commit 1cd8a2d
Show file tree
Hide file tree
Showing 27 changed files with 897 additions and 508 deletions.
4 changes: 2 additions & 2 deletions src/app/admin/assessments/assessment.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export class Assessment {

constructor(
public id: number,
public type: string
public id: number = -1,
public type: string = ''
) {}

static newInstance(data) {
Expand Down
39 changes: 0 additions & 39 deletions src/app/admin/assessments/assessments.component.html

This file was deleted.

52 changes: 46 additions & 6 deletions src/app/admin/assessments/assessments.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Subscription } from 'rxjs/Rx';

import { ASSESSMENT_TYPES } from '../../assessment/constants';
import { TaskService } from '../tasks/task.service';
Expand All @@ -7,24 +8,63 @@ import { QuestionService } from './question.service';
import { Assessment } from './assessment';

@Component({
selector: 'xp-assessments',
templateUrl: './assessments.component.html'
selector: 'xp-assessments',
template: `
<h1>Assessment Center</h1>
<h2>Please select a task</h2>
<div class="form-group">
<label for="task">Task</label>
<xp-loading-indicator [wait]="subscription">
<select
name="task"
id="task"
(ngModelChange)="onTaskChange($event)" [ngModel]="task_id">
<option value="0" disabled selected>Select Task</option>
<option *ngFor="let task of taskService.repository.getData()"
value="{{ task.id }}">
{{ task.title }}
</option>
</select>
</xp-loading-indicator>
</div>
<p *ngIf="(selectedTask != null)">
Task type:
<strong>{{ selectedTask?.assessment.type }}</strong>
</p>
<div [ngSwitch]="selectedTask?.assessment.id">
<xp-admin-assessments-micro-project
*ngSwitchCase="ASSESSMENT_TYPES.MICRO_PROJECT"
[task]="selectedTask">
</xp-admin-assessments-micro-project>
<xp-admin-assessments-question
*ngSwitchCase="ASSESSMENT_TYPES.QUESTION"
[task]="selectedTask">
</xp-admin-assessments-question>
<xp-admin-assessments-exam
*ngSwitchCase="ASSESSMENT_TYPES.EXAM"
[task]="selectedTask">
</xp-admin-assessments-exam>
</div>
`
})
export class AssessmentsComponent implements OnInit {
private selectedTask: Task = null;
private ASSESSMENT_TYPES = ASSESSMENT_TYPES;
private Assessment = Assessment;
private subscription: Subscription;

constructor(
private taskService: TaskService,
private questionService: QuestionService
) { }

ngOnInit() {
this.taskService.repository.setup(
this.taskService.apiGetURLS.all,
Task
);
this.subscription = this.taskService.setup();

this.questionService.getAll();
}
Expand Down

This file was deleted.

Empty file.
Loading

0 comments on commit 1cd8a2d

Please sign in to comment.