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){ where(user_id: author_id).first } scope :mine_hack, ->(author_id){ where(user_id: author_id) } scope :passed, -> {where(status: 1)} validates_length_of :notes, maximum: 5000, message: "不能超过5000个字" end