Skip to content

Commit

Permalink
Support Swing District zone filter
Browse files Browse the repository at this point in the history
  • Loading branch information
rapee committed Mar 23, 2019
1 parent 5935311 commit cb90a88
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/models/information/_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import { getProvinceById } from "."

// @ts-check

// Provinces where vote count difference between 1st and 2nd parties
// is less than 5% (source: Thailand general election 2554)
// @see https://github.com/codeforthailand/election-live/issues/22
const SWING_PROVINCES = [37, 26, 70, 25, 20, 10, 62, 64, 74]

/**
* Available filters.
*
Expand Down Expand Up @@ -70,13 +75,12 @@ export const filters = {
},
criterion: (province, zone) => false,
},
// @todo #18 Implement filtering code for Swing District
swing: {
name: {
th: "Swing District",
th: "เขตที่ไม่มีฐานเสียงชัดเจน",
en: "Swing District",
},
criterion: (province, zone) => false,
criterion: (province, zone) => SWING_PROVINCES.includes(province.id),
},
}

Expand Down

1 comment on commit cb90a88

@0pdd
Copy link

@0pdd 0pdd commented on cb90a88 Mar 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 18-3c00c6fa disappeared from src/models/information/_filters.js, that's why I closed #22. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.