feat: sort projects by end date

priority (first to last)
 - still active with last start date
 - still active
 - ended last
This commit is contained in:
Adrien Marquès 2022-10-18 17:01:05 +02:00
parent fe4af9ea62
commit a9022a02dd
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
1 changed files with 12 additions and 1 deletions

View File

@ -143,7 +143,18 @@ export default class Timeline extends Vue {
this.projects = [];
return;
}
this.projects = projects.bySkill(skill);
this.projects = projects.bySkill(skill).sort( (a, b) => {
if( b.stopped_at == null && a.stopped_at == null ){
return b.started_at.getTime() - a.started_at.getTime()
}
if( a.stopped_at != null && b.stopped_at == null ){
return 1;
}
if( b.stopped_at != null && a.stopped_at == null ){
return -1;
}
return b.started_at.getTime() - a.started_at.getTime();
});
}
private mounted() {