Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor raisepriority and track automatic prio bumps via history element #3994

Merged
merged 2 commits into from
Oct 13, 2017

Conversation

bgeuken
Copy link
Member

@bgeuken bgeuken commented Oct 11, 2017

No description provided.

@bgeuken bgeuken changed the title Refactor raisepriority Refactor raisepriority and track automatic prio bumps via history element Oct 11, 2017
@bgeuken bgeuken added the Frontend Things related to the OBS RoR app label Oct 11, 2017
This move the code that checks if we can raise the priority into a
separate method. This allows us to shorten the raisepriority method
quite some code duplication.

Both methods are now private.
Part of the bs request validation is to check, if the priority of a
associated bs_request_action is higher than the priority of the
bs_request.
If that's the case, the priority of the bs_request get's raised.

This wasn't logged via the history elements and might be one of the
culprits of Issue#3897 – history elements were missing.
@codecov
Copy link

codecov bot commented Oct 12, 2017

Codecov Report

Merging #3994 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3994      +/-   ##
==========================================
+ Coverage   89.23%   89.23%   +<.01%     
==========================================
  Files         309      309              
  Lines       18228    18228              
==========================================
+ Hits        16265    16266       +1     
+ Misses       1963     1962       -1
Flag Coverage Δ
#api 80.49% <85.71%> (ø) ⬆️
#rspec 69.81% <100%> (+0.02%) ⬆️
#webui 61.79% <85.71%> (+0.01%) ⬆️

@bgeuken
Copy link
Member Author

bgeuken commented Oct 12, 2017

@openSUSE/open-build-service Please review

@adrianschroeter Speak now or be silent forever;-)

return unless persisted?

# rubocop:disable Style/GuardClause
if priority_changed?
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you disable rubocop here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I am not going to write a guard claus for a 7 line statement 🤣

Copy link

@evanrolfe evanrolfe left a comment

Choose a reason for hiding this comment

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

LGTM. As a side comment though if we are going to be making a lot of changes to the priority stuff here I would suggest refactoring to use a gem like state_machine because it is made for exactly what we're doing and would handle a lot of stuff like validations out-of-the-box as well as give us a consistent interface to define priorities and their related logic.

https://github.com/pluginaweek/state_machine

@bgeuken
Copy link
Member Author

bgeuken commented Oct 13, 2017

Already spoke with Adrian today and he is fine with the approach => merging

@bgeuken bgeuken merged commit 5f380bf into openSUSE:master Oct 13, 2017
@bgeuken bgeuken deleted the refactor_raisepriority branch October 13, 2017 08:31
@bgeuken
Copy link
Member Author

bgeuken commented Oct 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frontend Things related to the OBS RoR app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants