Skip to content

Commit

Permalink
Fixed bug with parties without articles
Browse files Browse the repository at this point in the history
These parties are now no longer sent to the template
It previously (before moving data code) did get sent,
but it did not get used in final render either

This mainly fixes things in the Netherlands watchpigeon page currently
  • Loading branch information
Antifantwerp-Pigeon committed Oct 14, 2024
1 parent c05188a commit f969820
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/4-watchpigeon/watchpigeon.11tydata.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function (configData) {

areas.forEach((areaId) => {
// -- Get area data
const areaParties = AFAWatchpigeonParties.filter(party => party.areas.includes(areaId));
let areaParties = AFAWatchpigeonParties.filter(party => party.areas.includes(areaId));
const areaPartyIds = areaParties.map((party) => party.id)
const areaArticles = []; // Do not add values yet, see below //AFAWatchpigeonArticles.filter(article => article.responses.find((response) => areaPartyIds.includes(response.party.id)));
// -- Create output & calculation variables
Expand Down Expand Up @@ -89,6 +89,9 @@ export default function (configData) {
}
});

// Filter out areas without any relevant articles
areaParties = areaParties.filter(party => Object.keys(pointsByParty).includes(party.id));

// Convert from a possibly negative value to percentages to pass to client-side javascript
areaParties.map((party) => {
const partyId = party.id;
Expand Down

0 comments on commit f969820

Please sign in to comment.