implementation of import wip
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
class CodeHarborLink < ApplicationRecord
|
||||
validates :oauth2token, presence: true
|
||||
validates :user_id, presence: true
|
||||
|
||||
belongs_to :internal_user, foreign_key: :user_id
|
||||
alias_method :user, :internal_user
|
||||
alias_method :user=, :internal_user=
|
||||
|
||||
def to_s
|
||||
oauth2token
|
||||
end
|
||||
|
||||
end
|
12
app/models/codeharbor_link.rb
Normal file
12
app/models/codeharbor_link.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CodeharborLink < ApplicationRecord
|
||||
validates :oauth2token, presence: true
|
||||
validates :user_id, presence: true
|
||||
|
||||
belongs_to :user, foreign_key: :user_id, class_name: 'InternalUser'
|
||||
|
||||
def to_s
|
||||
oauth2token
|
||||
end
|
||||
end
|
@@ -31,7 +31,7 @@ class Exercise < ApplicationRecord
|
||||
|
||||
validate :valid_main_file?
|
||||
validates :description, presence: true
|
||||
validates :execution_environment_id, presence: true
|
||||
# validates :execution_environment_id, presence: true # TODO make this conditional - but based on what?
|
||||
validates :public, boolean_presence: true
|
||||
validates :title, presence: true
|
||||
validates :token, presence: true, uniqueness: true
|
||||
@@ -49,7 +49,7 @@ class Exercise < ApplicationRecord
|
||||
0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def finishers_percentage
|
||||
if users.distinct.count != 0
|
||||
(100.0 / users.distinct.count * finishers.count).round(2)
|
||||
|
Reference in New Issue
Block a user