Skip to content

web (job submission): enumerate and order batches correctly#6452

Merged
AenBleidd merged 2 commits intomasterfrom
dpa_submit39
Jul 21, 2025
Merged

web (job submission): enumerate and order batches correctly#6452
AenBleidd merged 2 commits intomasterfrom
dpa_submit39

Conversation

@davidpanderson
Copy link
Copy Markdown
Contributor

Also code cleanup

Copilot AI review requested due to automatic review settings July 21, 2025 19:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the batch enumeration and ordering system in the job submission web interface. The key changes include replacing database-level ordering with in-memory sorting, implementing consistent ordering across different batch states, and reorganizing function names for better clarity.

  • Removes database ORDER BY clauses and implements client-side sorting for proper batch ordering
  • Introduces specialized handling for in-progress batches that don't have completion times
  • Renames functions and actions for improved consistency and clarity throughout the interface

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
html/user/submit.php Major refactoring of batch sorting logic, function renaming, and code cleanup
html/inc/bootstrap.inc Updates navigation link to use new action name

$batches[] = $batch;
}
function show_aborted($all_batches, $order, $limit, $user, $app) {
$batches = batches_in_state($all_batches, BATCH_STATE_ABORTED);
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The show_aborted function receives an $order parameter but doesn't use it for sorting, unlike show_in_progress and show_complete functions. Consider adding sort_batches($batches, $order); after line 271 for consistency.

Suggested change
$batches = batches_in_state($all_batches, BATCH_STATE_ABORTED);
$batches = batches_in_state($all_batches, BATCH_STATE_ABORTED);
sort_batches($batches, $order);

Copilot uses AI. Check for mistakes.
$f = function($a, $b) {
return (int)($b->completion_time - $a->completion_time);
};
break;
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable $f is used without being initialized when the $order parameter doesn't match any of the expected cases ('sub_asc', 'sub_desc', 'comp_asc', 'comp_desc'). This will cause a fatal error. Add a default case or validate the $order parameter before the switch statement.

Suggested change
break;
break;
default:
$f = function($a, $b) {
return (int)($a->create_time - $b->create_time); // Default to 'sub_asc'
};
break;

Copilot uses AI. Check for mistakes.
@AenBleidd AenBleidd added this to Server Jul 21, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Server Jul 21, 2025
@AenBleidd AenBleidd added this to the Server Release 1.6.0 milestone Jul 21, 2025
@AenBleidd AenBleidd merged commit b861dba into master Jul 21, 2025
175 of 179 checks passed
@AenBleidd AenBleidd deleted the dpa_submit39 branch July 21, 2025 23:38
@github-project-automation github-project-automation bot moved this from Backlog to Done in Server Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants