Skip to content

Commit

Permalink
fix #1172
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNisnevich committed Jul 19, 2019
1 parent 6b7db21 commit aaae484
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/util/cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ export function sortCards(c1: w.CardInStore, c2: w.CardInStore, criteria: 0 | 1
// Individual sort columns that are composed into sort functions below.
// (Note: We convert numbers to base-36 to preserve sorting. eg. "10" < "9" but "a" > "9".)
const [timestamp, cost, name, type, attack, health, speed] = [
(c: w.CardInStore) => (9999999999999 - (c.timestamp || 0)).toString(36), // we want timestamp to be sorted backwards compared to other fields
// we want timestamp to be sorted backwards compared to other fields.
// also, created cards without a timestamp should still come before builtin cards.
(c: w.CardInStore) => (9999999999999 - (c.timestamp || (c.source === 'builtin' ? 0 : 1))).toString(36),
(c: w.CardInStore) => c.cost.toString(36),
(c: w.CardInStore) => c.name.toLowerCase(),
(c: w.CardInStore) => typeToString(c.type),
Expand Down

0 comments on commit aaae484

Please sign in to comment.