Skip to content

Commit 5137b15

Browse files
committed
Fix comparison of project names in the UI so projects actually match their data
1 parent f90f6c7 commit 5137b15

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/routes/donate/+page.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export async function load({ fetch }) {
2626
// Sort deals into their respective projects
2727
hubspotData.pipelineDeals.forEach((deal) => {
2828
content.props.projects.forEach((project) => {
29-
if (deal.properties.dealname.toLowerCase().includes(project.slug.toLowerCase())) {
29+
// Replace hyphens with spaces for comparison
30+
const projectNameForComparison = project.slug.toLowerCase().replace(/-/g, ' ');
31+
if (deal.properties.dealname.toLowerCase().includes(projectNameForComparison)) {
3032
projectDonations[project.slug].deals.push(deal);
3133
projectDonations[project.slug].total +=
3234
parseFloat(deal.properties.amount) || 0;

src/routes/donate/[slug]/+page.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ export async function load({ params, fetch }) {
3838

3939
// Get deals for this project
4040
hubspotData.pipelineDeals.forEach((deal) => {
41+
// Replace hyphens with spaces for comparison
42+
const projectNameForComparison = project.slug.toLowerCase().replace(/-/g, ' ');
4143
if (
4244
deal.properties.dealname.toLowerCase().includes(
43-
project.slug.toLowerCase(),
45+
projectNameForComparison
4446
)
4547
) {
4648
projectDonations.deals.push(deal);

static/data/hubspot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,5 +231,5 @@
231231
"totalDonations": 150,
232232
"totalMonthlyDonations": 0,
233233
"totalOneTimeDonations": 150,
234-
"lastUpdated": "2025-04-14T18:44:08.650Z"
234+
"lastUpdated": "2025-04-14T19:08:43.304Z"
235235
}

0 commit comments

Comments
 (0)