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
E2003, Refactor Assessment 360 Controller #1691
Conversation
Generated by expertiza-bot |
Hey @ramyananth, TravisCI finished with status |
# hashes for view | ||
@meta_review = {} | ||
@teammate_review = {} | ||
@teamed_count = {} | ||
# for course | ||
# eg. @overall_teammate_review_grades = {assgt_id1: 100, assgt_id2: 178, ...} | ||
# @overall_teammate_review_count = {assgt_id1: 1, assgt_id2: 2, ...} | ||
%w[teammate meta].each do |type| | ||
%w[teammate meta].each do |type| |
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 is a whitespace change, which should be removed.
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.
Professor, what about the Code climate "Trailing white space" issue that comes up?
avoid_divide_by_zero_error(@assignments,@overall_teammate_review_count,@overall_meta_review_count) | ||
end | ||
|
||
def avoid_divide_by_zero_error (assignments,overall_teammate_review_count,overall_meta_review_count) |
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 is not a good name for this method. I cannot understand what it is actually doing. Probably would be better to break it up into a method that could operate on either teammate_review_count or meta_review_count, and would be called once for each.
Even better: instead of teammate_review_count (or overall_teammate_review_count), have a teammate_reviews object and use teammate_reviews.count to return the count. But that may be too much to ask, since there's only one day left.
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.
The hash value for a student is calculated based on overall_teammate_review_count. Having just one function that can be called with teammate or meta variables might want us to do an extra check if the value passed is a teammate variable or a meta variable
…y of course_student_grade_summary, reduced cyclomatic complexity of all_students_all_reviews
…y of course_student_grade_summary, reduced cyclomatic complexity of all_students_all_reviews
overall_review_count(@assignments, @overall_teammate_review_count, @overall_meta_review_count) | ||
end | ||
|
||
def overall_review_count(assignments, overall_teammate_review_count, overall_meta_review_count) |
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.
Method overall_review_count
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def overall_review_count(assignments, overall_teammate_review_count, overall_meta_review_count) | ||
assignments.each do |assignment| | ||
temp_count = overall_teammate_review_count[assignment.id] | ||
overall_review_count_hash = 1 if temp_count.nil? or temp_count.zero? |
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.
Useless assignment to variable - overall_review_count_hash
.
unless @assignment_grades[cp.id][assignment_id].nil? | ||
@final_grades[cp.id] += @assignment_grades[cp.id][assignment_id] | ||
end | ||
def assignment_grade_summary(cp, assignment_id, user_id) |
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.
Assignment Branch Condition size for assignment_grade_summary is too high. [19/15]
Code Climate has analyzed commit 1df1e0e and detected 4 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 0.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 29.0% (-22.5% change). View more on Code Climate. |
unless @assignment_grades[cp.id][assignment_id].nil? | ||
@final_grades[cp.id] += @assignment_grades[cp.id][assignment_id] | ||
end | ||
def assignment_grade_summary(cp, assignment_id) |
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.
Assignment Branch Condition size for assignment_grade_summary is too high. [20.27/15]
Fixed the Course student grade summary page.
Added a function for eliminating the divide by zero error
Added a function for reviewing each student's info based on meta_review and teammate_review
Both functions that need to be refactored check if there are any course participants for the specific course. So this functionality is merged for both the functions.
Teammates: @ramyananth (rananth2) @ushvarma (suppala)