From 8f7fab31ca852d5b3d7889d3ed29321a25022421 Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Fri, 30 Aug 2024 09:48:08 +0100 Subject: [PATCH] interim commit --- .../themes/responsive/MyAccount/myCampaigns.tpl | 8 ++++---- code/web/services/MyAccount/MyCampaigns.php | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/code/web/interface/themes/responsive/MyAccount/myCampaigns.tpl b/code/web/interface/themes/responsive/MyAccount/myCampaigns.tpl index 63d6d5927e..3aa78f34c3 100644 --- a/code/web/interface/themes/responsive/MyAccount/myCampaigns.tpl +++ b/code/web/interface/themes/responsive/MyAccount/myCampaigns.tpl @@ -68,12 +68,12 @@ {$campaign->startDate} {$campaign->endDate} {$milestone->name} - {$campaign->milestoneCompletedGoals[$milestone->milestoneId]} / {$campaign->milestoneGoalCount[$milestone->milestoneId]} + {$campaign->milestoneCompletedGoals[$milestone->id]} / {$campaign->milestoneGoalCount[$milestone->id]}
-
- {$campaign->milestoneProgress[$milestone->milestoneId]}% +
+ {$campaign->milestoneProgress[$milestone->id]}%
diff --git a/code/web/services/MyAccount/MyCampaigns.php b/code/web/services/MyAccount/MyCampaigns.php index 300c5924c0..81ae434bd6 100644 --- a/code/web/services/MyAccount/MyCampaigns.php +++ b/code/web/services/MyAccount/MyCampaigns.php @@ -3,6 +3,7 @@ require_once ROOT_DIR . '/sys/Community/Campaign.php'; require_once ROOT_DIR . '/sys/Community/CampaignMilestone.php'; require_once ROOT_DIR . '/sys/Community/Milestone.php'; +require_once ROOT_DIR . '/sys/Community/UserCompletedMilestone.php'; class MyCampaigns extends MyAccount { @@ -15,6 +16,8 @@ function launch() { $userId = $this->getUserId(); $interface->assign('userId', $userId); + + $this->display('../MyAccount/myCampaigns.tpl', 'My Campaigns'); } @@ -50,7 +53,7 @@ function getCampaigns() { $campaign->milestones = $milestones; $milestoneGoalCounts = []; foreach ($milestones as $milestone) { - $milestoneId = $milestone->milestoneId; + $milestoneId = $milestone->id; //Calculate milestone progress $progressResult = $this->calculateMilestoneProgress($campaignId, $userId, $milestoneId); $milestoneProgress[$milestoneId] = $progressResult['progress']; @@ -68,8 +71,8 @@ function getCampaigns() { } function checkUserEnrollment($userId, $campaignId) { - global $aspen_db; - $query = "SELECT COUNT(*) AS count FROM user_campaign WHERE userId = :userId AND campaignId = :campaignId"; + global $aspen_db; // Assuming $aspen_db is your PDO instance + $query = "SELECT COUNT(*) AS count FROM ce_user_campaign WHERE userId = :userId AND campaignId = :campaignId"; $stmt = $aspen_db->prepare($query); // Execute the query with bound parameters