Skip to content

Commit

Permalink
showing others finalized #57 fix #29
Browse files Browse the repository at this point in the history
  • Loading branch information
Csutorás Robin committed Sep 22, 2017
1 parent 96ba755 commit b522748
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 26 deletions.
34 changes: 11 additions & 23 deletions app/controllers/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export default Ember.Controller.extend({
'Deliverable'
],
rowIndecies: [
'neptun',
'Event.StudentRegistration.User.neptun',
'displayName',
'uploadedAt',
'deadline',
'typeShortName',
'exerciseCategoryName',
'deliverableTemplateName'
'deadlineFormatted',
'Event.ExerciseSheet.ExerciseType.shortName',
'DeliverableTemplate.EventTemplate.ExerciseCategory.type',
'DeliverableTemplate.description'
],
filteredDeliverablesSelect: [],
headerGrading: [
Expand Down Expand Up @@ -133,21 +133,13 @@ export default Ember.Controller.extend({
offset: pageSize * this.get('page'),
limit: pageSize
}).then(deliverables => {
deliverables.forEach(x => {
x.set('uploadedAt', x.get('uploaded') ? dateformat([x.get('lastSubmittedDate')]) : 'No');
x.set('deadlineFormatted', dateformat([x.get('deadline')]));
});
this.set('filteredDeliverablesSelect', [
...this.get('filteredDeliverablesSelect'),
...deliverables.map(x => {
return ({
id: x.get('id'),
exerciseCategoryName: x.get('DeliverableTemplate.EventTemplate.ExerciseCategory.type'),
deliverableTemplateName: x.get('DeliverableTemplate.description'),
neptun: x.get('Event.StudentRegistration.User.neptun'),
displayName: x.get('Event.StudentRegistration.User.displayName'),
typeShortName: x.get('Event.ExerciseSheet.ExerciseType.shortName'),
uploadedAt: x.get('uploaded') ? dateformat([x.get('lastSubmittedDate')]) : 'No',
deadline: dateformat([x.get('deadline')]),
meta: x
});
})
...deliverables.map(x => x)
]);
this.set('page', this.get('page') + 1);
});
Expand All @@ -170,7 +162,7 @@ export default Ember.Controller.extend({
}
return false;
},
changeDeliverable({ meta: deliverable }) {
changeDeliverable(deliverable) {
this.set('success', false);
this.set('error', '');
deliverable.get('Event').then(event => {
Expand All @@ -183,10 +175,6 @@ export default Ember.Controller.extend({
});
return false;
},
changeDeliverableFromGrading(deliverable) {
this.actions.changeDeliverable.apply(this, [{ meta: deliverable }]);
return false;
},
book() {
this.set('success', false);
this.set('error', '');
Expand Down
9 changes: 6 additions & 3 deletions app/templates/evaluator.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
{{filter.value}}
{{/power-select}}
{{#if filteredDeliverables}}
{{table-component withoutNumber=true header=headerGrading body=filteredDeliverables rowIndecies=rowIndeciesGrading clickable=true changeEvent=(action 'changeDeliverableFromGrading') onClickRowAction='changeEvent'}}
{{table-component withoutNumber=true header=headerGrading body=filteredDeliverables rowIndecies=rowIndeciesGrading clickable=true changeEvent=(action 'changeDeliverable') onClickRowAction='changeEvent'}}
{{else}}
<div class="text">Nothing to show.</div>
{{/if}}
Expand All @@ -81,8 +81,11 @@
<div class="breadcrumb">
<button {{action 'backFromGrading'}}><i class="fa fa-arrow-left" aria-hidden="true"></i></button>
</div>
{{#unless (eq selectedDeliverable.Corrector.id model.user.id)}}
<div class="text">Sorry, you have not been chosen for grading this. First select this for grading, go to the 'Select for grading' menu.</div>
{{#unless (or (eq selectedDeliverable.Corrector.id model.user.id) selectedDeliverable.finalized)}}
<div class="text">
Sorry, you have not been chosen for grading this. First select this for grading, go to the 'Select for grading' menu.
Maybe the finalization has not been ended by other user. (BTW you should never see this message)
</div>
{{else}}
{{#unless selectedDeliverable.finalized}}
<button type="button" {{action 'unbook'}}>Unbook</button>
Expand Down

0 comments on commit b522748

Please sign in to comment.