added interventions back to code. added post method to be able to save interventions
This commit is contained in:
@@ -126,7 +126,8 @@ class Exercise < ActiveRecord::Base
|
||||
@working_time_statistics[user_id]["working_time"]
|
||||
end
|
||||
|
||||
def accumulated_working_time_for_only(user_id)
|
||||
def accumulated_working_time_for_only(user)
|
||||
user_type = user.external_user? ? "ExternalUser" : "InternalUser"
|
||||
Time.parse(self.class.connection.execute("""
|
||||
SELECT sum(working_time_new) AS working_time
|
||||
FROM
|
||||
@@ -136,7 +137,7 @@ class Exercise < ActiveRecord::Base
|
||||
(created_at - lag(created_at) over (PARTITION BY user_id, exercise_id
|
||||
ORDER BY created_at)) AS working_time
|
||||
FROM submissions
|
||||
WHERE exercise_id=#{id} and user_id=#{user_id} and user_type='ExternalUser') AS foo) AS bar
|
||||
WHERE exercise_id=#{id} and user_id=#{user.id} and user_type='#{user_type}') AS foo) AS bar
|
||||
""").first["working_time"] || "00:00:00").seconds_since_midnight
|
||||
end
|
||||
|
||||
|
@@ -144,7 +144,7 @@ class ProxyExercise < ActiveRecord::Base
|
||||
return 0.0
|
||||
end
|
||||
points_ratio_index = ((scoring_matrix.size - 1) * points_ratio).to_i
|
||||
working_time_user = ex.accumulated_working_time_for_only(user.id)
|
||||
working_time_user = ex.accumulated_working_time_for_only(user)
|
||||
quantiles_working_time = ex.get_quantiles(scoring_matrix_quantiles)
|
||||
quantile_index = quantiles_working_time.size
|
||||
quantiles_working_time.each_with_index do |quantile_time, i|
|
||||
|
Reference in New Issue
Block a user