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

Fixing NoMethodError: undefined method `+' for nil:NilClass #26677

Merged
merged 4 commits into from Jan 22, 2019

Conversation

bethanyaconnor
Copy link
Contributor

Fixing Honeybadger error that occurs when trying to generate a csv when some student counts are nil and some aren't.

@@ -99,7 +99,20 @@ def has_k8_grades?
end

def urm_percent
percent_of_students(student_am_count + student_hi_count + student_bl_count + student_hp_count)
total_urm_students = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest
[student_am_count, student_hi_count, student_bl_count, student_hp_count].compact.reduce(:+) instead for compactness

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh yeah that is much nicer!

@bethanyaconnor bethanyaconnor merged commit 41f5e12 into staging Jan 22, 2019
@bethanyaconnor bethanyaconnor deleted the honeybadger branch March 17, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants