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

Jtm fixing status bug #1039

Merged
merged 5 commits into from Aug 10, 2017
Merged

Jtm fixing status bug #1039

merged 5 commits into from Aug 10, 2017

Conversation

BigChiefSmidgeums
Copy link
Contributor

No description provided.

@@ -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}
Copy link
Contributor

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

Copy link
Contributor

@wtholt wtholt Aug 2, 2017

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

Copy link
Contributor Author

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.

@Stuart-Johnson Stuart-Johnson merged commit 25b0c05 into v3.0.0 Aug 10, 2017
@Stuart-Johnson Stuart-Johnson deleted the jtm_fixing_status_bug branch August 10, 2017 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants