.
This commit is contained in:
parent
f50aa4d49c
commit
f19757b434
6 changed files with 11 additions and 6 deletions
|
|
@ -49,9 +49,9 @@ app.conf.beat_schedule = {
|
|||
"task": "opportunity.tasks.check_stale_opportunities",
|
||||
"schedule": crontab(hour=8, minute=0),
|
||||
},
|
||||
# Check goal milestones and send notifications - daily at 9 AM
|
||||
# Check goal milestones and send notifications - daily at 9:15 AM
|
||||
"check-goal-milestones": {
|
||||
"task": "opportunity.tasks.check_goal_milestones",
|
||||
"schedule": crontab(hour=9, minute=0),
|
||||
"schedule": crontab(hour=9, minute=15),
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -518,4 +518,5 @@ class TestGoalMilestoneTask:
|
|||
# Should not trigger 90% (only at 60%)
|
||||
assert goal.milestone_90_notified is False
|
||||
# Already had 50% notified, should not re-send
|
||||
# mock_send may be called for other things, but milestone_50 was already True
|
||||
assert goal.milestone_50_notified is True
|
||||
assert mock_send.call_count == 0
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class SalesGoalListView(APIView, LimitOffsetPagination):
|
|||
"goals": serializer.data,
|
||||
"goals_count": total_count,
|
||||
"offset": offset,
|
||||
"per_page": 10,
|
||||
"per_page": self.get_limit(request),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -181,6 +181,7 @@ class SalesGoalLeaderboardView(APIView):
|
|||
|
||||
leaderboard = []
|
||||
for goal in goals:
|
||||
# compute_progress() results are cached on the instance
|
||||
progress = goal.compute_progress()
|
||||
if goal.target_value and goal.target_value != 0:
|
||||
percent = min(
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
<div class="flex items-center justify-between">
|
||||
<span class="truncate text-sm font-medium text-[var(--text-primary)]">{goal.name}</span>
|
||||
<span class="text-xs font-semibold {getStatusColor(goal.status)}">
|
||||
{goal.progress_percent}%
|
||||
{goal.progress_percent ?? 0}%
|
||||
</span>
|
||||
</div>
|
||||
<Progress
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ export async function load({ locals, cookies, url }) {
|
|||
};
|
||||
} catch (err) {
|
||||
console.error('Error loading goals from API:', err);
|
||||
throw error(500, `Failed to load goals: ${err.message}`);
|
||||
throw error(500, 'Failed to load goals');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -412,7 +412,10 @@
|
|||
{#each filteredGoals as goal (goal.id)}
|
||||
<tr
|
||||
class="cursor-pointer border-b border-[var(--border-default)] transition-colors hover:bg-[var(--surface-sunken)]/50"
|
||||
tabindex="0"
|
||||
role="button"
|
||||
onclick={() => openEditDrawer(goal)}
|
||||
onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); openEditDrawer(goal); } }}
|
||||
>
|
||||
<!-- Name -->
|
||||
<td class="px-4 py-3 font-medium text-[var(--text-primary)]">
|
||||
|
|
|
|||
Loading…
Reference in a new issue