Skip to content

Commit

Permalink
Simplify Submission#command_for
Browse files Browse the repository at this point in the history
The previous mechanism always cycled through all files once again, just to identify the very same file and using an attribute passed to the method. This can be simplified with the given refactoring.
  • Loading branch information
MrSerth authored and Dome-GER committed Oct 15, 2024
1 parent ca39aa4 commit 684e862
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ def swap_runner(old_runner)
[new_runner, new_waiting_duration]
end

def command_for(template, file)
filepath = collect_files.find {|f| f.filepath == file }.filepath
def command_for(template, filepath)
template % command_substitutions(filepath)
end

Expand Down

0 comments on commit 684e862

Please sign in to comment.