Filter out archived jobs and inactive customers from job lists
Added customer active status filtering to prevent jobs from deleted (inactive) customers from appearing in the UI alongside existing archived job filtering. Changes: - Daily Jobs: Filter jobs where customer is NULL or active=True - Run Checks: Filter jobs where customer is NULL or active=True - Jobs list: Filter jobs where customer is NULL or active=True This prevents showing jobs with "-" status from archived jobs or deleted customers on Daily Jobs and Run Checks pages. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
90ad06cca2
commit
a555dc9c61
@ -77,6 +77,7 @@ def daily_jobs():
|
||||
jobs = (
|
||||
Job.query.join(Customer, isouter=True)
|
||||
.filter(Job.archived.is_(False))
|
||||
.filter(db.or_(Customer.id.is_(None), Customer.active.is_(True)))
|
||||
.order_by(Customer.name.asc().nullslast(), Job.backup_software.asc(), Job.backup_type.asc(), Job.job_name.asc())
|
||||
.all()
|
||||
)
|
||||
|
||||
@ -18,6 +18,7 @@ def jobs():
|
||||
Job.query
|
||||
.filter(Job.archived.is_(False))
|
||||
.outerjoin(Customer, Customer.id == Job.customer_id)
|
||||
.filter(db.or_(Customer.id.is_(None), Customer.active.is_(True)))
|
||||
.add_columns(
|
||||
Job.id,
|
||||
Job.backup_software,
|
||||
|
||||
@ -841,7 +841,12 @@ def run_checks_page():
|
||||
)
|
||||
last_reviewed_map = {int(jid): (dt if dt else None) for jid, dt in last_reviewed_rows}
|
||||
|
||||
jobs = Job.query.filter(Job.archived.is_(False)).all()
|
||||
jobs = (
|
||||
Job.query.outerjoin(Customer)
|
||||
.filter(Job.archived.is_(False))
|
||||
.filter(db.or_(Customer.id.is_(None), Customer.active.is_(True)))
|
||||
.all()
|
||||
)
|
||||
today_local = _to_amsterdam_date(datetime.utcnow()) or datetime.utcnow().date()
|
||||
|
||||
for job in jobs:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user