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
Jtm fixing status bug #1039
Jtm fixing status bug #1039
Conversation
app/models/organization.rb
Outdated
@@ -357,7 +359,7 @@ def setup_available_statuses | |||
def get_available_statuses | |||
tmp_available_statuses = self.available_statuses.reject{|status| status.new_record?} | |||
statuses = [] | |||
if tmp_available_statuses.empty? | |||
if tmp_available_statuses.empty? || tmp_available_statuses.collect{|status| status.status} == DEFAULT_STATUSES.collect{|k, v| k} |
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.
It may be shorter to do tmp_available_statuses.map(&:status) == DEFAULT_STATUSES.keys
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.
#collect and #map are the same thing (https://stackoverflow.com/questions/5254732/difference-between-map-and-collect-in-ruby). I also think DEFAULT_STATUSES is an array.
So I think you could do
tmp_available_statuses.collect(&:status) == DEFAULT_STATUSES
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.
Thanks, Will! Works like a charm. I'll push the changes up.
No description provided.