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
Fixes #25562 - Product rendering issue without recurring logic #7854
Conversation
Issues: #25562 |
There were the following issues with the commit message:
If you don't have a ticket number, please create an issue in Redmine. More guidelines are available in Coding Standards or on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
@sjha4 thanks for the quick PR for this one |
app/models/katello/sync_plan.rb
Outdated
@@ -118,7 +118,7 @@ def sync_time | |||
end | |||
|
|||
def next_sync_date | |||
return nil unless (self.enabled || !self.foreman_tasks_recurring_logic.tasks.nil?) | |||
return nil unless (self.enabled || !self.foreman_tasks_recurring_logic.try(:tasks).nil?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you flip this to self.foreman_tasks_recurring_logic.try(:tasks).present?
? this would avoid a double negative
df3dce6
to
bfcadcb
Compare
@beav: Rubocop wouldn't allow me to catch all exceptions so using safe navigation to avoid nil values instead. |
@sjha4 looks good, thanks! I don't think this code is overly defensive, given that its trying to display something edit: the change looks good but if the missing field is from some other bug/issue, I would say we can address that and then close this pr without merging |
@sjha4 great thanks! |
This happens when there is a sync plan without a recurring logic. This should not happen in general but we need to handle the rendering issue regardless.
To reproduce: