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 CompetitionPrize < ApplicationRecord
|
|
|
|
extend Enumerize
|
|
|
|
|
|
|
|
belongs_to :competition
|
|
|
|
|
|
|
|
has_many :competition_prize_users, dependent: :destroy
|
|
|
|
|
|
|
|
enumerize :category, in: %i[bonus unset]
|
|
|
|
|
|
|
|
def member_certificate_exists?
|
|
|
|
Util::FileManage.exists?(self, self.class.member_suffix)
|
|
|
|
end
|
|
|
|
|
|
|
|
def teacher_certificate_exists?
|
|
|
|
Util::FileManage.exists?(self, self.class.teacher_suffix)
|
|
|
|
end
|
|
|
|
|
|
|
|
def team_certificate_exists?
|
|
|
|
Util::FileManage.exists?(self, self.class.team_suffix)
|
|
|
|
end
|
|
|
|
|
|
|
|
def member_certificate_path
|
|
|
|
Util::FileManage.source_disk_filename(self, self.class.member_suffix)
|
|
|
|
end
|
|
|
|
|
|
|
|
def teacher_certificate_path
|
|
|
|
Util::FileManage.source_disk_filename(self, self.class.teacher_suffix)
|
|
|
|
end
|
|
|
|
|
|
|
|
def team_certificate_path
|
|
|
|
Util::FileManage.source_disk_filename(self, self.class.team_suffix)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.member_suffix
|
|
|
|
'_member'
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.teacher_suffix
|
|
|
|
'_teacher'
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.team_suffix
|
|
|
|
'_team'
|
|
|
|
end
|
|
|
|
end
|