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
move media to correct status and set progess_limit correctly #19
move media to correct status and set progess_limit correctly #19
Conversation
elsif self.progress == media.progress_limit | ||
# when in current and episodes changed to 25 | ||
self.status = :completed | ||
elsif self.progress != media.progress_limit && status == 'completed' |
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.
Redundant self detected. (https://github.com/bbatsov/ruby-style-guide#no-self-unless-required)
# When marked completed, we try to update progress to the cap | ||
self.progress = media.progress_cap | ||
self.progress = media.progress_limit | ||
elsif self.progress == media.progress_limit |
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.
Redundant self detected. (https://github.com/bbatsov/ruby-style-guide#no-self-unless-required)
screw you timeout error. 🖕 |
self.progress = media.progress_cap | ||
self.progress = media.progress_limit | ||
elsif progress == media.progress_limit | ||
# when in current and episodes changed to 25 |
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.
This comment is cruel, evil stuff, please don't do that.
It's not "when it changes to 25"
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.
sorry sorry did that because i was using sao as my example.
@@ -99,9 +99,15 @@ def activity | |||
end | |||
|
|||
before_save do | |||
if status_changed? && status == :completed && media.progress_cap | |||
if status_changed? && status == 'completed' && media.progress_limit |
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.
I remembered that you can actually just do && completed?
due to the way enums work!
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.
oh, of course totally forgot about that.
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.
wait isn't it status.completed?
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.
nvm you were right I thought it would need to know the column name to reference (ie: status) but I guess it is smarter than me 😏
I'm dumb |
uhhh that is the way it works in v2? If it is set to 12/12 it goes to completed, if you change status to completed, it goes to completed (and sets to 12/12). Both of these options remove it from the list (in v2). |
Ajax still needs to be fixed to remove it from the list (if we do this) when the status is changed.
I am also not sure why
status == :completed
does not work, so just changed to a string.