Skip to content

Commit

Permalink
change private methods to non-private methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fosterfarrell9 committed Dec 7, 2023
1 parent 84ad08f commit 8cee213
Showing 1 changed file with 32 additions and 36 deletions.
68 changes: 32 additions & 36 deletions app/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,51 +266,47 @@ def self.bulk_corrections!(tutorial, assignment, files)
report
end

private
def self.number_of_submissions(tutorial, assignment)
Submission.where(tutorial: tutorial, assignment: assignment)
.where.not(manuscript_data: nil).size
end

def matching_lecture
return true if tutorial&.lecture == assignment&.lecture
def self.number_of_corrections(tutorial, assignment)
Submission.where(tutorial: tutorial, assignment: assignment)
.where.not(correction_data: nil).size
end

errors.add(:tutorial, :lecture_not_matching)
end
def self.number_of_late_submissions(tutorial, assignment)
Submission.where(tutorial: tutorial, assignment: assignment)
.where.not(manuscript_data: nil)
.count(&:too_late?)
end

def set_token
self.token = Submission.generate_token
end
def self.submissions_total(assignment)
Submission.where(assignment: assignment)
.where.not(manuscript_data: nil).size
end

def self.number_of_submissions(tutorial, assignment)
Submission.where(tutorial: tutorial, assignment: assignment)
.where.not(manuscript_data: nil).size
end
def self.corrections_total(assignment)
Submission.where(assignment: assignment)
.where.not(correction_data: nil).size
end

def self.number_of_corrections(tutorial, assignment)
Submission.where(tutorial: tutorial, assignment: assignment)
.where.not(correction_data: nil).size
end
def self.late_submissions_total(assignment)
Submission.where(assignment: assignment)
.where.not(manuscript_data: nil)
.count(&:too_late?)
end

def self.number_of_late_submissions(tutorial, assignment)
Submission.where(tutorial: tutorial, assignment: assignment)
.where.not(manuscript_data: nil)
.count(&:too_late?)
end
private

def self.submissions_total(assignment)
Submission.where(assignment: assignment)
.where.not(manuscript_data: nil).size
end
def matching_lecture
return true if tutorial&.lecture == assignment&.lecture

def self.corrections_total(assignment)
Submission.where(assignment: assignment)
.where.not(correction_data: nil).size
errors.add(:tutorial, :lecture_not_matching)
end

def self.late_submissions_total(assignment)
Submission.where(assignment: assignment)
.where.not(manuscript_data: nil)
.count(&:too_late?)
def set_token
self.token = Submission.generate_token
end

private_class_method :number_of_submissions, :number_of_corrections,
:number_of_late_submissions, :submissions_total,
:corrections_total, :late_submissions_total
end

0 comments on commit 8cee213

Please sign in to comment.