Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Commit

Permalink
close #7 sort games by last session start
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaster1 committed Dec 24, 2016
1 parent 9867dfb commit 015a4fe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/screen-games/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ export default class ScreenGames {
return foundState || defaultState
})

const lastSessionStart = game => game.sessions.length
? game.sessions[game.sessions.length - 1].start
: Date.now()

const allGames$ = this.gamesService.games$
.map(games => games.slice().reverse())
.map(games => games.slice().sort((a, b) => lastSessionStart(b) - lastSessionStart(a)))

this.game$ = this.route.queryParams
.pluck('id')
Expand Down

0 comments on commit 015a4fe

Please sign in to comment.