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