From d6a25b849632adbcc01f9f92f6765f3bb6bf725b Mon Sep 17 00:00:00 2001 From: Thomas Hille Date: Mon, 27 Mar 2017 18:52:44 +0200 Subject: [PATCH] do now assign dummy exercise to random group --- app/models/proxy_exercise.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/proxy_exercise.rb b/app/models/proxy_exercise.rb index a425b91b..bfef52ff 100644 --- a/app/models/proxy_exercise.rb +++ b/app/models/proxy_exercise.rb @@ -62,9 +62,9 @@ class ProxyExercise < ActiveRecord::Base rec_ex when :random_assigment @reason[:reason] = "random group" - rec_ex = exercises.shuffle.first - Rails.logger.debug("assigned user to random group, and gave him exercise: #{rec_ex.title}") - rec_ex + ex = exercises.where("expected_difficulty > 1").shuffle.first + Rails.logger.debug("assigned user to random group, and gave him exercise: #{ex.title}") + ex when :recommended_assignment exercises_user_has_accessed = user.submissions.where("cause IN ('submit','assess')").map{|s| s.exercise}.uniq.compact tags_user_has_seen = exercises_user_has_accessed.map{|ex| ex.tags}.uniq.flatten