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/hack_user_lastest_code.rb

18 lines
743 B

5 years ago
class HackUserLastestCode < ApplicationRecord
5 years ago
# passed 用户之前评测是否通过
5 years ago
# status: 最新评测状态: -1测试用例结果不匹配; 0: 评测通过; ;2 评测超时;3 创建pod失败; 4 编译失败;5 执行失败
# submit_status: 0: 可以评测, 1评测中
5 years ago
# passed_time:第一次通关的时间
5 years ago
# 编程题最新代码
5 years ago
belongs_to :hack, counter_cache: true
5 years ago
belongs_to :user
has_many :hack_user_codes, dependent: :destroy
has_one :hack_user_debug
5 years ago
scope :mine, ->(author_id){ where(user_id: author_id).first }
5 years ago
scope :mine_hack, ->(author_id){ where(user_id: author_id) }
5 years ago
scope :passed, -> {where(status: 1)}
5 years ago
validates_length_of :notes, maximum: 5000, message: "不能超过5000个字"
5 years ago
5 years ago
end