Add live dashboard for teachers in the context of an exercise

This commit also adds the fundamentals for ActionCable
This commit is contained in:
Sebastian Serth
2019-02-15 09:32:53 +01:00
parent 6e03939c10
commit d63700c7db
27 changed files with 215 additions and 7 deletions

View File

@ -1,5 +1,7 @@
class RequestForComment < ApplicationRecord
include Creation
include ActionCableHelper
belongs_to :submission
belongs_to :exercise
belongs_to :file, class_name: 'CodeOcean::File'
@ -10,6 +12,8 @@ class RequestForComment < ApplicationRecord
scope :unsolved, -> { where(solved: [false, nil]) }
scope :in_range, -> (from, to) { where(created_at: from..to) }
after_save :trigger_rfc_action_cable
def self.last_per_user(n = 5)
from("(#{row_number_user_sql}) as request_for_comments")
.where("row_number <= ?", n)