Skip to content

Commit

Permalink
Add camapignID to getUserProgress function
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderBlanchardAC committed Nov 11, 2024
1 parent c944aef commit f234d4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/web/services/MyAccount/MyCampaigns.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function getCampaigns() {

//Calculate milestone progress
$milestoneProgress = CampaignMilestone::getMilestoneProgress($campaignId, $userId, $milestone->id);
$progressData = CampaignMilestoneProgressEntry::getUserProgressDataByMilestoneId($userId, $milestoneId);
$progressData = CampaignMilestoneProgressEntry::getUserProgressDataByMilestoneId($userId, $milestoneId, $campaignId);

$milestone->progress = $milestoneProgress['progress'];
$milestone->completedGoals = $milestoneProgress['completed'];
Expand Down
4 changes: 3 additions & 1 deletion code/web/sys/Community/CampaignMilestoneProgressEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ public function initialize(CampaignMilestone $campaignMilestone, $args = null)
$this->insert();
}

public static function getUserProgressDataByMilestoneId($userId, $milestoneId) {
public static function getUserProgressDataByMilestoneId($userId, $milestoneId, $campaignId) {
$campaignMilestoneProgressEntry = new self();
$campaignMilestoneProgressEntry->whereAdd("userId = " . $userId);
$campaignMilestoneProgressEntry->whereAdd("ce_milestone_id = " . $milestoneId);
$campaignMilestoneProgressEntry->whereAdd("ce_campaign_id = " . $campaignId);


$results = [];
if ($campaignMilestoneProgressEntry->find()) {
Expand Down

0 comments on commit f234d4b

Please sign in to comment.