Skip to content

[ISDK-82] Feature/activity services #42

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2a8fb74
Move assessment and submission [ISDK-75]
imkven Oct 2, 2017
e4a11c0
Fix render error problem [ISDK-75]
imkven Oct 2, 2017
4d80266
Fix problem unable to submit [ISDK-75]
imkven Oct 2, 2017
435a0a5
Changing declared classes (WIP) [ISDK-75]
imkven Oct 2, 2017
681bc28
Update code standard (WIP) [ISDK-75]
imkven Oct 2, 2017
8cf28ac
Update to standard code [ISDK-75]
imkven Oct 2, 2017
a5fda7d
Update assessment code [ISDK-75]
imkven Oct 3, 2017
af61d9f
Merge branch 'develop' into feature/ISDK-75/assessment-submission-api
imkven Oct 4, 2017
49159b9
Merge branch 'develop' into feature/ISDK-75/assessment-submission-api
imkven Oct 17, 2017
e73b82a
[ISDK-82] done services changes
trtshen Oct 23, 2017
daab3a8
[ISDK-82] multiple port over
trtshen Oct 23, 2017
375fb44
[ISDK-82] some template enhancements
trtshen Oct 24, 2017
adaaeca
[ISDK-82] corrected usage of grid system
trtshen Oct 24, 2017
4fd7ffc
Merge branch 'develop' into feature/ISDK-82/activity-services
trtshen Oct 24, 2017
0f7e753
Fix conflict (WIP)
imkven Oct 25, 2017
1dd2ad6
Merge branch 'develop' into feature/ISDK-82/activity-services
trtshen Nov 6, 2017
32db9af
removed map file
trtshen Nov 6, 2017
9599660
[ISDK-92] santitise resource url first
trtshen Nov 6, 2017
6176f75
Merge branch 'develop' into feature/ISDK-82/activity-services
trtshen Nov 7, 2017
6b80630
[ISDK-82] fixed by using ng4 interpolate binding
trtshen Nov 7, 2017
2736ba1
Merge branch 'develop' into feature/ISDK-75/assessment-submission-api
imkven Nov 9, 2017
be50cb0
Merge branch 'develop' into feature/ISDK-82/activity-services
trtshen Nov 13, 2017
15f7a61
[ISDK-94] change type indicator
trtshen Nov 13, 2017
4a0c1a9
[ISDK-94] return empty if none provided
trtshen Nov 13, 2017
f4ec3f8
[ISDK-82] respond message from server
trtshen Nov 14, 2017
eb65d74
Merge branch 'develop' into feature/ISDK-75/assessment-submission-api
imkven Nov 15, 2017
fb3f582
updated yarn
trtshen Nov 21, 2017
7ca51b5
Merge branch 'feature/ISDK-75/assessment-submission-api' into feature…
trtshen Nov 21, 2017
adbdfd9
[ISDK-82] proper params type added
trtshen Nov 22, 2017
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
3,957 changes: 1,445 additions & 2,512 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@
"zone.js": "0.8.18"
},
"devDependencies": {
"@ionic/app-scripts": "3.0.0",
"@ionic/app-scripts": "^3.0.1",
"@types/jasmine": "^2.5.47",
"@types/node": "^7.0.13",
"angular2-template-loader": "^0.6.2",
"connect": "^3.6.0",
"del": "2.2.0",
"html-loader": "^0.4.5",
"jasmine": "^2.5.3",
"jasmine-core": "^2.8.0",
"jasmine-spec-reporter": "^4.2.1",
Expand Down
3 changes: 1 addition & 2 deletions src/components/assessments/assessments.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

<span class="title">{{ assessment['Assess.Assessment'].name }}</span>
</div>
<div class="spacer"></div>

<div class="answer">
<div class="answer spacer-top">
<div *ngIf="assessment['Assess.Assessment'].answer">

<div *ngIf="assessment['Assess.Assessment'].answer.type === 'checkin'">
Expand Down
4 changes: 1 addition & 3 deletions src/components/loadingMarker/loadingMarker.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<div>
<div class="list text-center" *ngIf="loading">
<ion-spinner icon="spiral" color="practera-thick"></ion-spinner>
</div>
<div *ngIf="!loading">
<p>transclude?</p>
<ng-content></ng-content>
</div>
</div>
4 changes: 2 additions & 2 deletions src/components/loadingMarker/loadingMarker.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Component } from '@angular/core';
import { Component, Input } from '@angular/core';

@Component({
selector: 'loading-marker',
templateUrl: 'loadingMarker.html'
})
export class LoadingMarkerComponent {

@Input() loading: any;
}
4 changes: 1 addition & 3 deletions src/components/question/question.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
<span class="title">{{ question.name }}</span>
</div>

<div class="spacer"></div>

<div class="answer">
<div class="answer spacer-top">
<div *ngIf="question.answer">
<div *ngIf="question.answer.type === 'file'">
<div *ngIf="question.answer.files.length === 1">
Expand Down
3 changes: 3 additions & 0 deletions src/pages/activities/list/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
refreshingSpinner="circles">
</ion-refresher-content>
</ion-refresher>

<ion-grid>
<ion-row class="score-board">
<ion-col class="score-board-inner">
Expand All @@ -41,6 +42,7 @@ <h1>{{ characterCurrentExperience }}</h1>
</div>
</ion-col>
</ion-row>

<ion-row class="activity-list">
<ion-col>
<!--<button (click)="shiftLanguageTrial()">Shift Language</button>-->
Expand All @@ -55,6 +57,7 @@ <h1>{{ characterCurrentExperience }}</h1>
{{ activity.Activity.name }}
</p>
</div>

<div *ngIf="activity.Activity.is_locked == true" class="locked">
<i class="fa fa-lock" aria-hidden="true"></i>
<p (click)="goToPopup(activity.Activity.unlock_id)" class="line-break">
Expand Down
1 change: 0 additions & 1 deletion src/pages/activities/list/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { loadingMessages, errMessages } from '../../../app/messages';
templateUrl: 'popup.html'
})
export class ActivityListPopupPage {

achievementData: any = null;
achievementName: string;
achievementsLoadingErr: any = errMessages.General.loading.load;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/activities/view/activities-view-modal.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
<ion-card *ngIf="activityData.video_url">
<ion-card-content>
<video controls width="100%" height="100%">
<source src='{{resourceUrl}}' autostart="false">
<source [src]='resourceUrl' autostart="false">
</video>
</ion-card-content>
</ion-card>
Expand Down
68 changes: 65 additions & 3 deletions src/pages/activities/view/activities-view.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class ActivitiesViewPage {
};
activity: any = {};
assessment: any = {};
assessments: any = {};
loadings = {
submissions: false
};
Expand Down Expand Up @@ -51,7 +50,6 @@ export class ActivitiesViewPage {
ionViewDidEnter(): void {
// assessment
this.activity = this.activityService.normaliseActivity(this.navParams.get('activity') || {});
this.assessments = this.activity.sequences || [];
this.assessment = this.activity.assessment;

// submission
Expand All @@ -64,6 +62,8 @@ export class ActivitiesViewPage {
return this.submissionService.normalise(submission);
});
this.submissions = _.orderBy(this.submissions, 'created', 'desc'); // latest at top

this.submissions = this.setSubmissionStatusTitle(this.submissions);
}
});

Expand Down Expand Up @@ -128,7 +128,7 @@ export class ActivitiesViewPage {
goAssessment(submission?, opts = { hasSubmission: false }) {
if ((this.inProgressSubmission()).length > 0 && opts.hasSubmission === false) {
let alert = this.alertCtrl.create({
title: 'You have a submission in progress.',
title: 'You already have started a new submission! Please tap on "In Progress" below to continue with it.',
buttons: ["Ok"]
});
alert.present();
Expand All @@ -146,4 +146,66 @@ export class ActivitiesViewPage {
});
}
}

/**
* @name setSubmissionStatusTitle
* @description refer to assessment status and inject proper UI displayable title for different submissions (in a assessments, multiple submission has no unique title, this function is added to help user identify different submission by title)
* @param {Array<object>} submissions submissions array objects
*/
setSubmissionStatusTitle(submissions: Array<any>) {
submissions = submissions.map((submission, index) => {
let result: {
name: string,
score: number,
published: boolean,
inprogress: boolean,
moderated_assessment: boolean
} = {
name: '',
score: 0,
published: false,
inprogress: false,
moderated_assessment: false
};

if (submission.status == "published") {
result.published = true;

switch (submission.moderated_score) {
case "1":
result.score = 4;
result.name = "Outstanding";
break;
case "0.75":
result.score = 3;
result.name = "Commendable";
break;
case "0.5":
result.score = 2;
result.name = "Competent";
break;
case "0.25":
result.score = 1;
result.name = "Developing";
break;
case "0":
result.score = 0;
result.name = "Needs Improvement";
}
} else if(submission.status == "in progress") {
result.inprogress = true;
} else {
result.inprogress = false;
}

if (submission.assessment.assessment_type == "moderated") {
result.moderated_assessment = true;
}

submission.statusTitle = result;
return submission;
});

return submissions;
}
}
33 changes: 22 additions & 11 deletions src/pages/activities/view/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,33 @@
</ion-list-header>

<ion-item *ngIf="loadings.submissions" class="center">
<ion-spinner>Loading submissions...</ion-spinner>
<loading-marker [loading]="loadings.submissions">
<p>Loading submissions...</p>
</loading-marker>
</ion-item>

<ion-item *ngFor="let submission of submissions" (click)="goAssessment(submission, {hasSubmission: true})">
<ion-row>

<ion-col align-self-start>
<div>
<h2>{{ (submission.submitted || submission.created).format() | amDateFormat:"MMM D YYYY, h:mm a" }}</h2>
</div>
<ion-item *ngFor="let submission of submissions" (click)="goAssessment(submission, {hasSubmission: true})" no-lines>
<ion-row *ngIf='!submission.statusTitle.published'>
<ion-col class="submission-title" col-10>
<h2 *ngIf='!submission.statusTitle.inprogress && submission.statusTitle.moderated_assessment'>Waiting for Review</h2>
<h2 *ngIf='!submission.statusTitle.inprogress && !submission.statusTitle.moderated_assessment'>Done</h2>
<h2 *ngIf='submission.statusTitle.inprogress'>In Progress</h2>
<p>{{ (submission.submitted || submission.created).format() | amDateFormat:"MMM D YYYY, h:mm a" }}</p>
</ion-col>

<ion-col align-self-end class="note">
<ion-note>{{ submission.status }}</ion-note>
<ion-col class="note" col-2 *ngIf="submission.status !== 'done'">
<i class="fa fa-clock-o" aria-hidden="true"></i>
</ion-col>
</ion-row>

<ion-row *ngIf='submission.statusTitle.published'>
<ion-col class="submission-title" col-10>
<h2 *ngIf="submission.statusTitle">{{ submission.statusTitle | truncate: 50 }}</h2>
<h2 *ngIf="!submission.statusTitle">{{ submission.statusTitle.name }}</h2>
<p>{{ (submission.submitted || submission.created).format() | amDateFormat:"MMM D YYYY, h:mm a" }}</p>
</ion-col>
<ion-col class="note" col-2>
<ion-badge>{{ submission.statusTitle.score }}</ion-badge>
</ion-col>
</ion-row>
</ion-item>
</ion-list>
Expand Down
17 changes: 7 additions & 10 deletions src/pages/assessments/assessments.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<ion-header>
<ion-navbar>
<ion-title></ion-title>

<ion-buttons end>
<button ion-button (click)="clickSubmit()" class="btn-submit" *ngIf="allowSubmit">
{{ 'GENERAL.SUBMIT' | translate }}
Expand All @@ -11,21 +10,19 @@
</ion-header>
<ion-content class="assessments-list">

<div *ngFor="let assessmentGroup of assessmentGroups; let i = index">
<div *ngFor="let assessment of assessmentGroup; let j = index">
<div *ngFor="let assessmentGroup of assessmentGroups">
<div *ngFor="let assessment of assessmentGroup">

<ion-card *ngIf="assessment.description" class="no-box-shadow">
<ion-card *ngIf="assessment.description || assessment.name" class="no-box-shadow">
<ion-card-content>
<h2 class="text-center">{{ assessment.name }}</h2>
<div [innerHTML]="assessment.description"></div>
<h2 class="text-center assessment-title">{{ assessment.name }}</h2>
<p [innerHTML]="assessment.description" class="assessment-description"></p>
</ion-card-content>
</ion-card>

<questionGroup
*ngFor="let group of assessment.AssessmentGroup; let q = index"
*ngFor="let group of assessment.AssessmentGroup"
[group]="group"
(click)="gotoAssessment(group, activity)"
>
(click)="gotoAssessment(group, activity)">
</questionGroup>
</div>
</div>
Expand Down
Loading