Merge pull request #110 from ThommyH/reduceInterventionAmount
do not show interventions on solved exercises, reduce to 2 interventions per day
This commit is contained in:
@ -328,6 +328,9 @@ configureEditors: function () {
|
||||
});
|
||||
|
||||
$('#askForCommentsButton').on('click', this.requestComments.bind(this));
|
||||
$('#closeAskForCommentsButton').on('click', function(){
|
||||
$('#comment-modal').modal('hide');
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
button.prop('disabled', false);
|
||||
|
@ -40,7 +40,7 @@ class ExecutionEnvironmentsController < ApplicationController
|
||||
FROM
|
||||
(SELECT user_id,
|
||||
exercise_id,
|
||||
CASE WHEN working_time >= '0:30:00' THEN '0' ELSE working_time END AS working_time_new
|
||||
CASE WHEN working_time >= '0:05:00' THEN '0' ELSE working_time END AS working_time_new
|
||||
FROM
|
||||
(SELECT user_id,
|
||||
exercise_id,
|
||||
|
@ -21,7 +21,7 @@ class ExercisesController < ApplicationController
|
||||
private :authorize!
|
||||
|
||||
def max_intervention_count
|
||||
2
|
||||
3
|
||||
end
|
||||
|
||||
|
||||
@ -165,7 +165,8 @@ class ExercisesController < ApplicationController
|
||||
|
||||
def implement
|
||||
redirect_to(@exercise, alert: t('exercises.implement.no_files')) unless @exercise.files.visible.exists?
|
||||
user_got_enough_interventions = UserExerciseIntervention.where(exercise: @exercise, user: current_user).count >= max_intervention_count
|
||||
user_solved_exercise = @exercise.has_user_solved(current_user)
|
||||
user_got_enough_interventions = UserExerciseIntervention.where(user: current_user).where("created_at >= ?", Time.zone.now.beginning_of_day).count >= max_intervention_count
|
||||
is_java_course = @course_token && @course_token.eql?(java_course_token)
|
||||
|
||||
user_intervention_group = UserGroupSeparator.getInterventionGroup(current_user)
|
||||
@ -173,9 +174,9 @@ class ExercisesController < ApplicationController
|
||||
case user_intervention_group
|
||||
when :no_intervention
|
||||
when :break_intervention
|
||||
@show_break_interventions = (!is_java_course || user_got_enough_interventions) ? "false" : "true"
|
||||
@show_break_interventions = (user_solved_exercise || !is_java_course || user_got_enough_interventions) ? "false" : "true"
|
||||
when :rfc_intervention
|
||||
@show_rfc_interventions = (!is_java_course || user_got_enough_interventions) ? "false" : "true"
|
||||
@show_rfc_interventions = (user_solved_exercise || !is_java_course || user_got_enough_interventions) ? "false" : "true"
|
||||
end
|
||||
|
||||
@search = Search.new
|
||||
|
@ -27,7 +27,7 @@ class ExternalUsersController < ApplicationController
|
||||
score,
|
||||
id,
|
||||
CASE
|
||||
WHEN working_time >= '0:30:00' THEN '0'
|
||||
WHEN working_time >= '0:05:00' THEN '0'
|
||||
ELSE working_time
|
||||
END AS working_time_new
|
||||
FROM
|
||||
|
@ -67,7 +67,7 @@ class Exercise < ActiveRecord::Base
|
||||
sum(working_time_new) AS working_time
|
||||
FROM
|
||||
(SELECT user_id,
|
||||
CASE WHEN working_time >= '0:30:00' THEN '0' ELSE working_time END AS working_time_new
|
||||
CASE WHEN working_time >= '0:05:00' THEN '0' ELSE working_time END AS working_time_new
|
||||
FROM
|
||||
(SELECT user_id,
|
||||
id,
|
||||
@ -169,7 +169,7 @@ class Exercise < ActiveRecord::Base
|
||||
exercise_id,
|
||||
max_score,
|
||||
CASE
|
||||
WHEN working_time >= '0:30:00' THEN '0'
|
||||
WHEN working_time >= '0:05:00' THEN '0'
|
||||
ELSE working_time
|
||||
END AS working_time_new
|
||||
FROM all_working_times_until_max ), result AS
|
||||
@ -263,7 +263,7 @@ class Exercise < ActiveRecord::Base
|
||||
|
||||
FILTERED_TIMES_UNTIL_MAX AS
|
||||
(
|
||||
SELECT user_id,exercise_id, max_score, CASE WHEN working_time >= '0:30:00' THEN '0' ELSE working_time END AS working_time_new
|
||||
SELECT user_id,exercise_id, max_score, CASE WHEN working_time >= '0:05:00' THEN '0' ELSE working_time END AS working_time_new
|
||||
FROM ALL_WORKING_TIMES_UNTIL_MAX
|
||||
)
|
||||
SELECT e.external_id AS external_user_id, f.user_id, exercise_id, MAX(max_score) AS max_score, sum(working_time_new) AS working_time
|
||||
@ -341,6 +341,10 @@ class Exercise < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def has_user_solved(user)
|
||||
return maximum_score(user).to_i == maximum_score.to_i
|
||||
end
|
||||
|
||||
def set_default_values
|
||||
set_default_values_if_present(public: false)
|
||||
end
|
||||
|
@ -6,4 +6,6 @@ textarea.form-control#question(style='resize:none;')
|
||||
p = ''
|
||||
/ data-cause='requestComments' is not used here right now, we pass the button #requestComments (not askForCommentsButton) as initiator of the action.
|
||||
/ But if we use this button, it will work since the correct cause is supplied
|
||||
div
|
||||
button#askForCommentsButton.btn.btn-block.btn-primary(type='button' data-cause='requestComments' data-message-success=t('exercises.editor.request_for_comments_sent')) =t('exercises.implement.comment.request')
|
||||
button#closeAskForCommentsButton.btn.btn-block.btn-warning(type='button') =t('activerecord.attributes.request_for_comments.close')
|
||||
|
@ -93,6 +93,7 @@ de:
|
||||
username: Benutzername
|
||||
requested_at: Angefragezeitpunkt
|
||||
question: "Frage"
|
||||
close: "Fenster schließen"
|
||||
submission:
|
||||
cause: Anlass
|
||||
code: Code
|
||||
@ -279,7 +280,7 @@ de:
|
||||
request: "Kommentaranfrage stellen"
|
||||
question: "Bitte beschreiben Sie kurz ihre Probleme oder nennen Sie den Programmteil, zu dem Sie Feedback wünschen."
|
||||
rfc_intervention:
|
||||
text: "Es scheint so als würden sie Probleme mit der Aufgabe haben. Wenn Sie möchten, können wir Ihnen helfen!"
|
||||
text: "Es scheint so als würden Sie Probleme mit der Aufgabe haben. Wenn Sie möchten, können wir Ihnen helfen!"
|
||||
break_intervention:
|
||||
title: "Pause"
|
||||
text: "Uns ist aufgefallen, dass du schon lange an dieser Aufgabe arbeitest. Möchtest du vielleicht später weiter machen um erstmal auf neue Gedanken zu kommen?"
|
||||
|
@ -114,6 +114,7 @@ en:
|
||||
username: Username
|
||||
requested_at: Request Date
|
||||
question: "Question"
|
||||
close: Close window
|
||||
submission:
|
||||
cause: Cause
|
||||
code: Code
|
||||
|
Reference in New Issue
Block a user