From 1827a744b323663a337e6c0c43c430d2b5ad8cd0 Mon Sep 17 00:00:00 2001 From: Nalin Bhardwaj Date: Wed, 13 Dec 2017 16:19:35 +0530 Subject: [PATCH] scraper.js, main.html: Wiki fixes Stops caching wikidata/wikipedia links. Unloads the urls into top level instead of storing inside "wiki". Closes https://github.com/coala/gci-leaders/issues/82 --- lib/scrape.js | 12 +++--------- templates/main.html | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/scrape.js b/lib/scrape.js index 022cfa7..678724b 100644 --- a/lib/scrape.js +++ b/lib/scrape.js @@ -278,11 +278,7 @@ async function fetchOrgsWithData() { if (existingOrg && existingOrg.chat) return existingOrg.chat else return chattie(org.irc_channel) }) - const fetchingWiki = orgs.map(org => { - const existingOrg = existingData.find(existing => existing.id === org.id) - if (existingOrg && existingOrg.wiki) return existingOrg.wiki - else return findWiki(org.name) - }) + const fetchingWiki = orgs.map(org => findWiki(org.name)) const orgLeaders = await Promise.all(fetchingLeaders) const orgGitHub = await Promise.all(fetchingGitHub) const orgChats = await Promise.all(fetchingChat) @@ -322,10 +318,8 @@ async function fetchOrgsWithData() { ? orgChats[index].image : CHAT_IMAGES[chattie.CHAT[orgChats[index].type]], }, - wiki: { - wikipedia: orgWiki[index].wikipedia, - wikidata: orgWiki[index].wikidata, - }, + wikipedia_urls: orgWiki[index].wikipedia, + wikidata_url: orgWiki[index].wikidata, }) }) diff --git a/templates/main.html b/templates/main.html index a33004b..2884947 100644 --- a/templates/main.html +++ b/templates/main.html @@ -79,16 +79,16 @@

{{/website_url}} - {{#wiki.wikipedia.en}} - + {{#wikipedia_urls.en}} + - {{/wiki.wikipedia.en}} - {{#wiki.wikidata}} - + {{/wikipedia_urls.en}} + {{#wikidata_url}} + - {{/wiki.wikidata}} + {{/wikidata_url}}
{{/noLeader}}