SHARE
TWEET

Untitled

a guest Jun 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. this.calculationService.getSumsByProject().subscribe(sum =>
  2.    console.log(sum);
  3. }
  4.      
  5. projects: Project[] = [
  6. {name: 'MISSING',ids:[]},
  7. {name: 'Project1', ids:['pid75.22','pid75.23']},
  8. {name: 'Project2', ids:['pid75.22','pid75.23']},
  9. {name: 'Project3', ids:['pid66.1','pid33.99']},
  10. {name: 'Project4', ids:['pdi75.88','pid99.15']}]
  11.      
  12. currentUserIds=['pid75.22','pid100.03','pid75.88','Not Specified']
  13.      
  14. pid75.22:6
  15. pid100.03:0
  16. pid75.88:15
  17. Not specified:36
  18.      
  19. loggedProjectNames: string[];
  20. loggedProjectHours: string[];
  21.  
  22. projectByName(name: string): Project {
  23.         return _.find(this.projects, { name }) || this.projects[0];
  24.   }
  25.  
  26. ngOnInit() {
  27.     this.calculationService.getSumsByProject().subscribe(sum => {
  28.       //console.log(sum);
  29.       this.loggedProjectNames = _.keys(sum);
  30.       this.loggedProjectHours = _.values(sum);
  31.       //console.log(this.loggedProjectNames,": ",this.loggedProjectHours);
  32.       this.loggedProjectNames.forEach(name => {
  33.         const found = this.projectByName(name);
  34.         this.currentUserIds.forEach(id => {
  35.            console.log(_.find(found.ids, i => i === id));
  36.         })
  37.       })
  38.     });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top