From bdf018b38263a90b465c48edf1c0be49ae437080 Mon Sep 17 00:00:00 2001 From: Sjeff Date: Fri, 27 Mar 2026 21:19:19 +0100 Subject: [PATCH 1/2] fix: show only account-specific scheduler jobs and remove partial: prefix from job names --- backend/src/api/main.py | 2 ++ backend/src/api/routers/accounts.py | 4 +++- backend/src/services/scheduler_service.py | 1 + frontend/src/hooks/useScheduler.ts | 11 ++++++++--- frontend/src/pages/Dashboard.tsx | 5 ++++- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/backend/src/api/main.py b/backend/src/api/main.py index fa2f5fc..e6a5e06 100644 --- a/backend/src/api/main.py +++ b/backend/src/api/main.py @@ -108,6 +108,7 @@ async def lifespan(app: FastAPI): job_id=f"automation_cycle_{account.id}", minutes=scan_interval, start_date=start_date, + name="Automation cycle", ) started_count += 1 @@ -117,6 +118,7 @@ async def lifespan(app: FastAPI): func=partial(safety_check_cycle, account_id=account.id), job_id=f"safety_check_{account.id}", seconds=45, + name="Safety check", ) logger.info("safety_check_job_started", account_id=account.id, interval_seconds=45) diff --git a/backend/src/api/routers/accounts.py b/backend/src/api/routers/accounts.py index a65c62e..b74694f 100644 --- a/backend/src/api/routers/accounts.py +++ b/backend/src/api/routers/accounts.py @@ -153,7 +153,7 @@ async def get_account_scheduler_status(account_id: int, account_service: Account except ResourceNotFoundError as e: raise HTTPException(status_code=404, detail=str(e)) - account_job_ids = {f"automation_cycle_{account_id}", f"safety_check_{account_id}"} + account_job_ids = {f"automation_cycle_{account_id}", f"safety_check_{account_id}", f"win_check_{account_id}"} account_jobs = [j for j in scheduler_manager.get_jobs() if j.id in account_job_ids] job_info = [] @@ -211,6 +211,7 @@ async def start_account_automation(account_id: int, account_service: AccountServ job_id=f"automation_cycle_{account_id}", minutes=scan_interval, start_date=start_date, + name="Automation cycle", ) if account.safety_check_enabled: @@ -218,6 +219,7 @@ async def start_account_automation(account_id: int, account_service: AccountServ func=partial(safety_check_cycle, account_id=account_id), job_id=f"safety_check_{account_id}", seconds=45, + name="Safety check", ) return create_success_response(data={"started": True, "account_id": account_id}) diff --git a/backend/src/services/scheduler_service.py b/backend/src/services/scheduler_service.py index 6eba7c1..c1f0e8c 100644 --- a/backend/src/services/scheduler_service.py +++ b/backend/src/services/scheduler_service.py @@ -409,6 +409,7 @@ def _schedule_win_check_job(self, run_date: datetime) -> None: func=self._win_check_callback, job_id=self._win_check_job_id, run_date=run_date, + name="Win check", ) logger.info( diff --git a/frontend/src/hooks/useScheduler.ts b/frontend/src/hooks/useScheduler.ts index 4254d7a..1df911c 100644 --- a/frontend/src/hooks/useScheduler.ts +++ b/frontend/src/hooks/useScheduler.ts @@ -12,13 +12,18 @@ export const schedulerKeys = { }; /** - * Fetch global scheduler status (whether the scheduler process is running) + * Fetch scheduler status, scoped to the selected account when available */ export function useSchedulerStatus() { + const selectedAccountId = useAccountStore((s) => s.selectedAccountId); + return useQuery({ - queryKey: schedulerKeys.status, + queryKey: [...schedulerKeys.status, selectedAccountId], queryFn: async () => { - const response = await api.get('/api/v1/scheduler/status'); + const endpoint = selectedAccountId + ? `/api/v1/accounts/${selectedAccountId}/scheduler/status` + : '/api/v1/scheduler/status'; + const response = await api.get(endpoint); if (!response.success) { throw new Error(response.error || 'Failed to fetch scheduler status'); } diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 32f3a48..5b1d15e 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -557,7 +557,10 @@ function JobCountdown({ job }: JobCountdownProps) { }, [job.next_run]); const jobLabel = job.name === 'scan_giveaways' ? 'Next scan' : - job.name === 'process_giveaways' ? 'Next process' : job.name; + job.name === 'process_giveaways' ? 'Next process' : + job.name === 'Automation cycle' ? 'Next scan' : + job.name === 'Safety check' ? 'Safety check' : + job.name === 'Win check' ? 'Win check' : job.name; return ( From d2c6b823679fca7f439faf1ab5a613029c4f0845 Mon Sep 17 00:00:00 2001 From: Sjeff Date: Fri, 27 Mar 2026 21:19:47 +0100 Subject: [PATCH 2/2] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a13731..7f77a0b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "name": "steamselfgifter", - "version": "3.0.1", + "version": "3.0.2", "private": true }