mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Refactor to make it logic clearer
The logic around what gets shown on the uploads page was hard to follow. This commit makes three changes to hopefully make it easier: - remove the passing-around of a string containing the contents of a rendered partial - encapsulate everything in one `show_scheduled_jobs` variable, rather than mixing between `scheduled_jobs` and `current_service.scheduled_jobs` - adds a comment to explain why we still render `_jobs.html` even when we know we have no jobs
This commit is contained in:
@@ -52,19 +52,14 @@ def uploads(service_id):
|
||||
if uploads.prev_page:
|
||||
next_page = generate_next_dict('main.uploads', service_id, uploads.current_page)
|
||||
|
||||
scheduled_jobs = ''
|
||||
if uploads.current_page == 1:
|
||||
scheduled_jobs = render_template(
|
||||
'views/dashboard/_upcoming.html',
|
||||
hide_heading=True,
|
||||
)
|
||||
|
||||
return render_template(
|
||||
'views/jobs/jobs.html',
|
||||
jobs=uploads,
|
||||
prev_page=prev_page,
|
||||
next_page=next_page,
|
||||
scheduled_jobs=scheduled_jobs,
|
||||
show_scheduled_jobs=(
|
||||
uploads.current_page == 1 and current_service.scheduled_jobs
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user