Sha256: aee47f783b115d2f6650dd8e0ff88b319f470e909ff906fe213d48ac48a9287f
Contents?: true
Size: 744 Bytes
Versions: 18
Compression:
Stored size: 744 Bytes
Contents
require 'securerandom' class Submission include ActiveModel::Model required :try_evaluate! def run!(assignment, evaluation) save_submission! assignment results = evaluation.evaluate! assignment, self save_results! results, assignment notify_results! results, assignment results end def evaluate!(assignment) try_evaluate! assignment rescue => e {status: :errored, result: e.message} end def id @id ||= SecureRandom.hex(8) end private def save_submission!(assignment) assignment.content = content assignment.save! end def save_results!(results, assignment) assignment.update! results end def notify_results!(results, assignment) assignment.notify! end end
Version data entries
18 entries across 18 versions & 1 rubygems