Skip to content

Conversation

@adi-herwana-nus
Copy link
Contributor

No description provided.

class Course::Assessment::Question::VoiceResponse < ApplicationRecord
acts_as :question, class_name: 'Course::Assessment::Question'

def is_saving_snapshots?
Copy link

Choose a reason for hiding this comment

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

Naming/PredicateName: Rename is_saving_snapshots? to saving_snapshots?.

OR course_assessment_answer_programming_auto_gradings.question_snapshot_id = #{@programming_question.id})
SQL
)

Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/TrailingWhitespace: Trailing whitespace detected.

AND (course_assessment_answer_programming_auto_gradings.question_snapshot_id IS NULL
OR course_assessment_answer_programming_auto_gradings.question_snapshot_id = #{@programming_question.id})
SQL
)
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/ClosingParenthesisIndentation: Align ) with (.

snapshot.skip_process_package = true
snapshot.save!

update_result = ActiveRecord::Base.connection.execute(<<-SQL.squish
Copy link

Choose a reason for hiding this comment

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

Lint/UselessAssignment: Useless assignment to variable - update_result. Did you mean update_timestamp?


def update
result = @programming_question.class.transaction do
old_update_timestamp = @programming_question.snapshot_of_state_at
Copy link

Choose a reason for hiding this comment

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

Lint/UselessAssignment: Useless assignment to variable - old_update_timestamp. Did you mean update_timestamp?

end

def destroy_snapshots
self.snapshots.where.not(id: self).destroy_all
Copy link

Choose a reason for hiding this comment

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

[Correctable] Style/RedundantSelf: Redundant self detected.

!skip_process_package?
end

def is_saving_snapshots?
Copy link

Choose a reason for hiding this comment

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

Naming/PredicateName: Rename is_saving_snapshots? to saving_snapshots?.

self.categories = duplicator.duplicate(other.categories)
end

def is_saving_snapshots?
Copy link

Choose a reason for hiding this comment

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

Naming/PredicateName: Rename is_saving_snapshots? to saving_snapshots?.

acts_as :question, class_name: 'Course::Assessment::Question'
has_one_attachment

def is_saving_snapshots?
Copy link

Choose a reason for hiding this comment

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

Naming/PredicateName: Rename is_saving_snapshots? to saving_snapshots?.


accepts_nested_attributes_for :groups, allow_destroy: true

def is_saving_snapshots?
Copy link

Choose a reason for hiding this comment

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

Naming/PredicateName: Rename is_saving_snapshots? to saving_snapshots?.

end
end
def get_first_test_failures_by_type(test_cases_by_type, test_results_by_type)
test_cases_by_type.entries.map do |test_case_type, test_cases|
Copy link

Choose a reason for hiding this comment

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

[Correctable] Style/HashTransformValues: Prefer transform_values over map {...}.to_h.

# subclasses.
#
# @param [Course::Assessment::Answer] answer The answer to be evaluated.
# @param [Course::Assessment::Answer::AutoGrading] auto_grading The auto grading object that will store the results.
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/CommentIndentation: Incorrect indentation detected (column 4 instead of 2).

# and makes sure answer is in the correct state.
#
# @param [Course::Assessment::Answer] answer The answer to be graded.
# @param [Course::Assessment::Answer::AutoGrading] auto_grading The auto grading object that will store the results.
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/CommentIndentation: Incorrect indentation detected (column 4 instead of 2).

# our original question by comparing the updated_at timestamps.
programming_auto_grading.question_snapshot_id =
Course::Assessment::Question::Programming.
where(current_id: question.id, snapshot_index: question.snapshot_index).first&.id || question.id
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/MultilineMethodCallIndentation: Align where with Course::Assessment::Question::Programming. on line 14.


# If the question was updated during the evaluation, we can still find
# our original question by comparing the updated_at timestamps.
programming_auto_grading.question_snapshot_id =
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/TrailingWhitespace: Trailing whitespace detected.

# For now, we have to manually query the latest_answer_ids first.
latest_answer_ids = @question.answers.
unscope(:order).
select('DISTINCT ON (submission_id) id').
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/MultilineMethodCallIndentation: Align select with @question.answers. on line 16.

# In Rails 8, it will be possible to override the batch ordering using :cursor.
# For now, we have to manually query the latest_answer_ids first.
latest_answer_ids = @question.answers.
unscope(:order).
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/MultilineMethodCallIndentation: Align unscope with @question.answers. on line 16.

end
end

json.(auto_grading, :stdout, :stderr) if show_stdout_and_stderr
Copy link

Choose a reason for hiding this comment

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

[Correctable] Style/LambdaCall: Prefer the use of lambda.call(...) over lambda.(...).

end
elsif first_failures_by_type['private_test']
explanations << format_ckeditor_rich_text(get_hint(
first_failures_by_type['private_test'],
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/FirstArgumentIndentation: Indent the first argument one step more than get_hint(.

end
if first_failures_by_type['public_test']
explanations << format_ckeditor_rich_text(get_hint(
first_failures_by_type['public_test'],
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/FirstArgumentIndentation: Indent the first argument one step more than get_hint(.

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