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

Add point views #483

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add point views #483

wants to merge 2 commits into from

Conversation

irenenikk
Copy link

Add "my points"-section to course pages, where student can see their points for that course. Also add the possibility to export a csv-file of the points of a specific part (sheet in the code) of the course.

missing = AvailablePoint.course_points(course).order!.map(&:name) - awarded
@missing_points[course_id] = missing

if awarded.size + missing.size > 0

Choose a reason for hiding this comment

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

Style/ConditionalAssignment: Use the return of the conditional for variable assignment and comparison.
Style/NumericPredicate: Use (awarded.size + missing.size).positive? instead of awarded.size + missing.size > 0.

@group_completion_ratios = {}
@awarded_points.keys.each do |course_id|
course = Course.find(course_id)
unless course.hide_submissions?

Choose a reason for hiding this comment

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

Style/Next: Use next to skip iteration.

module PointVisualisation
extend ActiveSupport::Concern

def set_point_stats(user)

Choose a reason for hiding this comment

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

Naming/AccessorMethodName: Do not prefix writer method names with set_.

end
end
end
end

Choose a reason for hiding this comment

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

Layout/EndAlignment: end at 32, 0 is not aligned with module at 2, 1.

missing = AvailablePoint.course_points(course).order!.map(&:name) - awarded
@missing_points[course_id] = missing

if (awarded.size + missing.size).positive?

Choose a reason for hiding this comment

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

Style/ConditionalAssignment: Use the return of the conditional for variable assignment and comparison.

@group_completion_ratios = {}
@awarded_points.keys.each do |course_id|
course = Course.find(course_id)
if course.hide_submissions?

Choose a reason for hiding this comment

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

Style/GuardClause: Use a guard clause instead of wrapping the code inside a conditional expression.

@@ -0,0 +1,32 @@
# frozen_string_literal: true.
module PointVisualisation
extend ActiveSupport::Concern

Choose a reason for hiding this comment

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

Layout/IndentationWidth: Use 2 (not 1) spaces for indentation.

@@ -0,0 +1,32 @@
# frozen_string_literal: true.
module PointVisualisation

Choose a reason for hiding this comment

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

Layout/InitialIndentation: Indentation of first line in file detected.

@missing_points[course_id] = missing

@percent_completed[course_id] =
if (awarded.size + missing.size).positive?

Choose a reason for hiding this comment

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

Layout/IndentAssignment: Indent the first line of the right-hand-side of a multi-line assignment.

@@ -0,0 +1,30 @@
# frozen_string_literal: true.

Choose a reason for hiding this comment

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

Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
Layout/CommentIndentation: Incorrect indentation detected (column 1 instead of 0).

Use PointVisualisation concern to add required variables
@nygrenh nygrenh force-pushed the bs4 branch 3 times, most recently from 3974ce8 to 5684048 Compare April 22, 2019 14:36
@nygrenh nygrenh force-pushed the bs4 branch 3 times, most recently from a65b1b3 to ae0f1e8 Compare February 6, 2020 19:00
Base automatically changed from bs4 to master January 27, 2021 10:08
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.

2 participants