-
Notifications
You must be signed in to change notification settings - Fork 897
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
Added before_save to MiqTask to initialize MiqTask#started_on when task become active #16863
Added before_save to MiqTask to initialize MiqTask#started_on when task become active #16863
Conversation
@yrudman so this will set started_on to be essentially equal to created_on which isn't very useful. |
app/models/miq_task.rb
Outdated
@@ -27,7 +27,8 @@ class MiqTask < ApplicationRecord | |||
before_validation :initialize_attributes, :on => :create | |||
|
|||
before_destroy :check_active, :check_associations | |||
|
|||
before_save :started |
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.
Perhaps ensure_started
as a method name? started
is an adjective, and a verb reads nicer.
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.
LGTM... Just change the method name.
@agrare We do show data previously displayed in |
@yrudman 👍 I missed the |
@miq-bot add-label gaprindashvili/yes |
Checked commits yrudman/manageiq@a56d3b7~...0c8969b with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0 |
@Fryguy method name changed, ready for merge |
…to-initialize-strted_on Added before_save to MiqTask to initialize MiqTask#started_on when task become active (cherry picked from commit d992f98)
Gaprindashvili backport details:
|
Before:
MiqTask#started_on
was not set ifstate
attribute updated directly (liketask.update_attributes(:state => MiqTask::STATE_ACTIVE)
)related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1536126
After:
Added
before_save
callback to initialize#started_on
whenstate
set to "Active"@miq-bot add-label core, technical debt
\cc @gtanzillo @jameswnl