
Tags can be added to exercises in the edit view. Tags can monitored under /tags. Added the concept of ProxyExercises which are a collection of Exercises. They can be found under /proxy_exercises Added Interventions as prework to show interventions later to the user. Added exercise/[:id]/working_time to return the working time of the user in this exercise and the average working time of all users in this exercise
27 lines
492 B
Ruby
27 lines
492 B
Ruby
class ProxyExercise < ActiveRecord::Base
|
|
|
|
after_initialize :generate_token
|
|
|
|
has_and_belongs_to_many :exercises
|
|
has_many :user_proxy_exercise_exercises
|
|
|
|
def count_files
|
|
exercises.count
|
|
end
|
|
|
|
def generate_token
|
|
self.token ||= SecureRandom.hex(4)
|
|
end
|
|
private :generate_token
|
|
|
|
def duplicate(attributes = {})
|
|
proxy_exercise = dup
|
|
proxy_exercise.attributes = attributes
|
|
proxy_exercise
|
|
end
|
|
|
|
def to_s
|
|
title
|
|
end
|
|
|
|
end |