Skip to content

Instantly share code, notes, and snippets.

@falonofthetower
Created April 11, 2017 22:11
Show Gist options
  • Save falonofthetower/f2c8c007c6297461683b64279bc7dc98 to your computer and use it in GitHub Desktop.
Save falonofthetower/f2c8c007c6297461683b64279bc7dc98 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
const { inject: { service }, Component } = Ember;
export default Component.extend({
session: service('session'),
currentUser: service('currentUser'),
myAssignments: Ember.computed.filter('assignments', function(assignment) {
let user = this.get('currentUser').user;
return assignment.get('assignee').then((assignee) => {
assignee.get('id') === user.id;
});
}),
requestedAssignments: Ember.computed.filter('myAssignments', function(assignment) {
return assignment.get('status') === "requested";
}),
pendingAssignments: Ember.computed.filter('myAssignments.@each.status', function(assignment) {
return assignment.get('status') === "pending";
}),
closedAssignments: Ember.computed.filter('myAssignments.@each.status', function(assignment) {
return assignment.get('status') === "accepted";
}),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment