Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeubell committed Dec 13, 2023
1 parent 1e99c2c commit 43c92e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ SVGS := $(patsubst %,_includes/svg/%,$(notdir $(wildcard assets/fontawesome/*.sv
PWD=$(shell pwd)
RED=\033[0;31m
CLR=\033[0m
NODE_OPTIONS=--openssl-legacy-provider

build: $(SVGS)
npm run build
Expand All @@ -19,11 +20,11 @@ pull-finance:
npm run pull

serve-docker: $(SVGS)
npm run watch &
NODE_OPTIONS=$(NODE_OPTIONS) npm run watch &
jekyll serve --incremental

serve: $(SVGS)
npm run watch &
NODE_OPTIONS=$(NODE_OPTIONS) npm run watch &
bundle exec jekyll serve --incremental

setup:
Expand Down
18 changes: 6 additions & 12 deletions src/components/contributions-table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ class ContributionsTable extends React.Component {
}

applySortOrder(contributions) {
const { sort } = this.state;
const { sortOnElectionName } = this.state;
const { sortElectionNameOrder } = this.state;
const { sort, sortOnElectionName, sortElectionNameOrder } = this.state;

const codepointCompare = (x, y) => {
// sort falsey values to the bottom, rather than to the top
Expand All @@ -122,7 +120,7 @@ class ContributionsTable extends React.Component {
return 0;
};

function parseElectionName(input) {
const parseElectionName = (input) => {
const [ename, ...rest] = input.split('-');

if (rest.length === 1) {
Expand All @@ -135,19 +133,15 @@ class ContributionsTable extends React.Component {
}
// Handle the case where there are no elements after the split
return { ename, month: 'november', year: undefined };
}
};

const electionCompare = (x, y) => {
const election1 = parseElectionName(x);
const election2 = parseElectionName(y);

if (election1.name > election2.name) {
return 1;
}
if (election1.name < election2.name) {
return -1;
}

// we don't need to sort on name beause, while its unlikely to have
// two jurisdictions for the same IEC, we want the contributions sorted
// by date.
if (election1.year > election2.year) {
return 1;
}
Expand Down

0 comments on commit 43c92e3

Please sign in to comment.