Skip to content

Commit

Permalink
adjust fix for #139
Browse files Browse the repository at this point in the history
  • Loading branch information
lordblendi committed Nov 16, 2020
1 parent 823f858 commit 7cb94ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 8 additions & 0 deletions app/controllers/demonstrator/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ export default Ember.Controller.extend({
session: Ember.inject.service('session'),
classNames: ['demonstrator-group'],

noGroupToShow: false,

// TODO: move to models/eventTemplate.js when the Events attribute is filtered in the get call.
sortedEventsByCourseCode: Ember.computed('model', function () {
this.set("noGroupToShow", false);
return new RSVP.Promise((resolve, reject) => {
if (this.get('model.id')) {
this.get('store').query('event', {
Expand Down Expand Up @@ -47,13 +50,18 @@ export default Ember.Controller.extend({
finalEventsByCourseCode[sorted.courseCode] = separatedEventsByCourseCode[sorted.courseCode];
});

if(Object.keys(finalEventsByCourseCode).length === 0) {
this.set("noGroupToShow", true);
}

resolve(finalEventsByCourseCode);
}, err => {
console.error(err);
reject(err);
});
}
else {
this.set("noGroupToShow", true);
resolve({});
}
});
Expand Down
9 changes: 6 additions & 3 deletions app/templates/demonstrator/detail.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
{{#each-in eventsByDate as |date events|}}
{{demonstrator-group-data currentEventTemplate=model events=(await events) evaluateEvent=(action 'evaluateEvent')}}
{{/each-in}}
{{else}}
Nincs megjeleníthető laborcsoport.
{{/each-in}}
{{/each-in}}

{{#if noGroupToShow}}
<hr/>
Nincs megjeleníthető laborcsoport.
{{/if}}

0 comments on commit 7cb94ec

Please sign in to comment.