diff --git a/source/plugins/sponsors/index.mjs b/source/plugins/sponsors/index.mjs index e3b73b77..b6b43c19 100644 --- a/source/plugins/sponsors/index.mjs +++ b/source/plugins/sponsors/index.mjs @@ -14,7 +14,7 @@ export default async function({login, q, imports, data, graphql, queries, accoun const {[account]:{sponsorsListing:{fullDescription, activeGoal}}} = await graphql(queries.sponsors.description({login, account})) const about = await imports.markdown(fullDescription, {mode:"multiline"}) const goal = activeGoal ? {progress:activeGoal.percentComplete, title:activeGoal.title, description:await imports.markdown(activeGoal.description)} : null - const count = {active:{total:0, user:0, organization:0}, past:{total:0, user:0, organization:0}} + const count = {total:{count:0, user:0, organization:0}, active:{total:0, user:0, organization:0}, past:{total:0, user:0, organization:0}} //Query active sponsors let list = [] @@ -66,6 +66,11 @@ export default async function({login, q, imports, data, graphql, queries, accoun } } + //Update counters + count.total.count = count.active.total + count.past.total + count.total.user = count.active.user + count.past.user + count.total.organization = count.active.organization + count.past.organization + //Results list = list.sort((a, b) => a.past === b.past ? b.amount - a.amount : a.past - b.past) return {sections, about, list, count, goal} diff --git a/source/plugins/sponsors/metadata.yml b/source/plugins/sponsors/metadata.yml index aa3bac3c..a6176dee 100644 --- a/source/plugins/sponsors/metadata.yml +++ b/source/plugins/sponsors/metadata.yml @@ -31,6 +31,7 @@ inputs: values: - goal - about + - list plugin_sponsors_past: description: | diff --git a/source/templates/classic/partials/sponsors.ejs b/source/templates/classic/partials/sponsors.ejs index fbf495db..92dcd021 100644 --- a/source/templates/classic/partials/sponsors.ejs +++ b/source/templates/classic/partials/sponsors.ejs @@ -14,23 +14,25 @@ <% } else { %> - <% for (const section of plugins.sponsors.sections) { %> - <% if ((section === "goal")&&(plugins.sponsors.goal)) { %> + <% for (const section of plugins.sponsors.sections) { if ((plugins.sponsors.sections.includes("goal"))&&(plugins.sponsors.sections.includes("list"))&&(section === "list")) continue%> + <% if ((section === "goal")||(section === "list")) { %>