Skip to content

Commit

Permalink
Merge pull request #2 from basexhq/main
Browse files Browse the repository at this point in the history
Add Stripe
  • Loading branch information
GregTrifan authored Feb 26, 2024
2 parents ae7bbc5 + 5ec21bb commit ecc4f10
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 7 deletions.
24 changes: 18 additions & 6 deletions evaluations/grabEvaluations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const sqlite3 = require("sqlite3");
const { planetaryBoundaries } = require("../utils/categoriesEval");
const { planetaryBoundaries, SDG, EBF, unitedPlanet } = require("../utils/categoriesEval");

const SQL_query_evaluations = `
SELECT Items.*, JSONIPFS.json
Expand All @@ -21,7 +21,7 @@ const getImageURL = (category, i) => {
case "United Planet":
return `/img/unitedplanet/up${i}.png`;
case "Planetary Boundaries":
return "planetary";
return "/img/planetary-boundaries.png";
default:
return "";
}
Expand Down Expand Up @@ -100,14 +100,26 @@ async function grabEvaluations(staging = false) {
Number(evalData[valueKey] ?? 0) !== 0 ||
(evalData[commentKey] ?? "") !== ""
) {
let title = "";
switch (category) {
case "SDG":
title = SDG[i-1];
break;
case "EBF":
title = EBF[i-1];
break;
case "United Planet":
title = unitedPlanet[i-1];
break;
case "Planetary Boundaries":
title = planetaryBoundaries[i-1];
}

justificationArray.push({
percentage: Number(evalData[valueKey] ?? 0),
comment: evalData[commentKey] ?? "",
imageURL: getImageURL(category, i),
planetaryBoundary:
category === "Planetary Boundaries"
? planetaryBoundaries[i]
: "",
title: title
});
}
}
Expand Down
56 changes: 55 additions & 1 deletion utils/categoriesEval.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// THIS FILE SHOULD BE EXACTLY THE SAME AS FRONT-END
// TODO: better sharing of resources between front-end and back-end

const planetaryBoundaries = [
"Climate Change",
"Biosphere Integrity",
Expand All @@ -7,6 +10,57 @@ const planetaryBoundaries = [
"Biogeochemical Flows",
"Ocean Acidification",
"Atmospheric Aerosol Loading",
"Novel entities"
];

module.exports = { planetaryBoundaries };
const SDG = [
"No Poverty",
"Zero Hunger",
"Good Health and Well-being",
"Quality Education",
"Gender Equality",
"Clean Water and Sanitation",
"Affordable and Clean Energy",
"Decent Work and Economic Growth",
"Industry, Innovation, and Infrastructure",
"Reduced Inequality",
"Sustainable Cities and Communities",
"Responsible Consumption and Production",
"Climate Action",
"Life Below Water",
"Life on Land",
"Peace, Justice, and Strong Institutions",
"Partnerships for the Goals",
]

const EBF = [
"Air",
"Water",
"Soil",
"Biodiversity",
"Equity",
"Carbon"
]

const unitedPlanet = [
"Health & Wellbeing",
"Water Security",
"Unleashing Potential",
"Sustainable Food",
"Community Abundance",
"Wealthy Commons",
"Regenerative Cities",
"Instrastructure Transformation",
"Gender Harmony",
"Peace & Justice",
"Thriving for all",
"Circular Economies",
"Planetary Health",
"Ocean Stewardship",
"Ubiquitous Energy",
"Land Stewardship"
]



module.exports = { planetaryBoundaries, SDG, EBF, unitedPlanet };

0 comments on commit ecc4f10

Please sign in to comment.