You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/models/exercise_user.rb

13 lines
773 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

class ExerciseUser < ApplicationRecord
belongs_to :user
belongs_to :exercise
scope :commit_exercise_by_status, lambda { |s| where(commit_status: s) }
scope :exercise_user_committed, -> {where("commit_status != ?",0) }
scope :current_exercise_user, lambda { |user_id,exercise_id| where(user_id: user_id,exercise_id:exercise_id)}
scope :exercise_commit_users, lambda {|user_ids| where(user_id:user_ids)}
scope :exercise_review, -> {where("subjective_score >= ?",0.0)} #已评阅,测试版的不一样是因为测试版的 主观题默认为0。0分没有修改为-1分
scope :exercise_unreview, -> {where("subjective_score < ?",0.0)} #未评阅
scope :search_by_exercise, lambda {|ids| where(exercise_id:ids)} #根据试卷来查找
end