37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script to verify progress updates are working
|
|
"""
|
|
import json
|
|
from pdf_renamer import job_queue, load_jobs, save_jobs
|
|
|
|
# Load current jobs
|
|
load_jobs()
|
|
print('Current jobs:')
|
|
for job_id, job in job_queue.items():
|
|
status = job.get('status', 'unknown')
|
|
progress = job.get('progress', 'none')
|
|
print(f' {job_id}: status={status}, progress="{progress}"')
|
|
|
|
# Test updating progress
|
|
if job_queue:
|
|
test_job_id = list(job_queue.keys())[0]
|
|
print(f'\nTesting progress update for job {test_job_id}')
|
|
|
|
# Update progress
|
|
job_queue[test_job_id]['progress'] = 'Test progress update - ' + str(len(job_queue))
|
|
save_jobs()
|
|
|
|
# Reload and check
|
|
job_queue.clear()
|
|
load_jobs()
|
|
|
|
updated_progress = job_queue.get(test_job_id, {}).get('progress', 'not found')
|
|
print(f'Updated progress: "{updated_progress}"')
|
|
|
|
if 'Test progress update' in updated_progress:
|
|
print('✅ Progress updates are working!')
|
|
else:
|
|
print('❌ Progress updates not working')
|
|
else:
|
|
print('No jobs found to test with') |