Skip to content

Commit

Permalink
interim commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderBlanchardAC committed Aug 30, 2024
1 parent a4864cf commit 8f7fab3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
<td>{$campaign->startDate}</td>
<td>{$campaign->endDate}</td>
<td>{$milestone->name}</td>
<td> {$campaign->milestoneCompletedGoals[$milestone->milestoneId]} / {$campaign->milestoneGoalCount[$milestone->milestoneId]}</td>
<td> {$campaign->milestoneCompletedGoals[$milestone->id]} / {$campaign->milestoneGoalCount[$milestone->id]}</td>
<td>
<div class="progress" style="width:100%; border:1px solid black; border-radius:4px;height:20px;">
<div class="progress-bar" role="progressbar" aria-valuenow="{$campaign->milestoneProgress[$milestone->milestoneId]}" aria-valuemin="0"
aria-valuemax="100" style="width: {$campaign->milestoneProgress[$milestone->milestoneId]}%; line-height: 20px; text-align: center; color: #fff;">
{$campaign->milestoneProgress[$milestone->milestoneId]}%
<div class="progress-bar" role="progressbar" aria-valuenow="{$campaign->milestoneProgress[$milestone->id]}" aria-valuemin="0"
aria-valuemax="100" style="width: {$campaign->milestoneProgress[$milestone->id]}%; line-height: 20px; text-align: center; color: #fff;">
{$campaign->milestoneProgress[$milestone->id]}%
</div>
</div>
</td>
Expand Down
9 changes: 6 additions & 3 deletions code/web/services/MyAccount/MyCampaigns.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -15,6 +16,8 @@ function launch() {

$userId = $this->getUserId();
$interface->assign('userId', $userId);


$this->display('../MyAccount/myCampaigns.tpl', 'My Campaigns');
}

Expand Down Expand Up @@ -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'];
Expand All @@ -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
Expand Down

0 comments on commit 8f7fab3

Please sign in to comment.