Skip to content

Commit

Permalink
The time from deadline is shown (in English) #37
Browse files Browse the repository at this point in the history
  • Loading branch information
Csutorás Robin committed Sep 16, 2017
1 parent bd35adc commit bfc93c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
25 changes: 7 additions & 18 deletions app/components/student-laboratory.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,20 @@ export default Ember.Component.extend({
});
}
}),
init: function () {
init() {
this._super();
return this.tick();
},
tick: function () {
tick() {
this.toggleProperty("toggleTime");
return setTimeout(((function (_this) {
return function () {
return _this.tick();
};
})(this)), 1000 * 60 * 15);
return setTimeout(() => {
this.tick();
}, 1000 * 60 * 15);
},
toggleTime: true,
timeLeft: Ember.computed('toggleTime', function () {
var deadline, diff;
deadline = this.get('result.deadline');
diff = moment(deadline).diff(moment(), 'hours');
if ((diff <= 0)) {
diff = moment(deadline).diff(moment(), 'minutes');
if ((diff <= 0)) {
diff = 0;
}
return diff + " perc";
}
return diff + " óra";
const deadline = this.get('result.firstCorrectableDeliverable.deadline'); // TODO: do for each deliverable, maybe with different components
return moment(deadline).fromNow();
}),
actions: {
selectCommit(Deliverable, newcommit) {
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/student-laboratory.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{{/if}}
{{#if (eq Deliverable.DeliverableTemplate.type 'FILE')}}
<div class="text label">{{Deliverable.DeliverableTemplate.description}} határideje:</div>
<div class="text">{{dateformat Deliverable.deadline}}</div>
<div class="text">{{dateformat Deliverable.deadline}} ({{timeLeft}})</div>
{{student-laboratory-upload Deliverable=Deliverable}}
<div class="text label">{{Deliverable.DeliverableTemplate.description}} érdemjegye:</div>
{{#if Deliverable.finalized}}
Expand Down

0 comments on commit bfc93c7

Please sign in to comment.