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));
|
$('#askForCommentsButton').on('click', this.requestComments.bind(this));
|
||||||
|
$('#closeAskForCommentsButton').on('click', function(){
|
||||||
|
$('#comment-modal').modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
button.prop('disabled', false);
|
button.prop('disabled', false);
|
||||||
|
@ -40,7 +40,7 @@ class ExecutionEnvironmentsController < ApplicationController
|
|||||||
FROM
|
FROM
|
||||||
(SELECT user_id,
|
(SELECT user_id,
|
||||||
exercise_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
|
FROM
|
||||||
(SELECT user_id,
|
(SELECT user_id,
|
||||||
exercise_id,
|
exercise_id,
|
||||||
|
@ -21,7 +21,7 @@ class ExercisesController < ApplicationController
|
|||||||
private :authorize!
|
private :authorize!
|
||||||
|
|
||||||
def max_intervention_count
|
def max_intervention_count
|
||||||
2
|
3
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -165,7 +165,8 @@ class ExercisesController < ApplicationController
|
|||||||
|
|
||||||
def implement
|
def implement
|
||||||
redirect_to(@exercise, alert: t('exercises.implement.no_files')) unless @exercise.files.visible.exists?
|
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)
|
is_java_course = @course_token && @course_token.eql?(java_course_token)
|
||||||
|
|
||||||
user_intervention_group = UserGroupSeparator.getInterventionGroup(current_user)
|
user_intervention_group = UserGroupSeparator.getInterventionGroup(current_user)
|
||||||
@ -173,9 +174,9 @@ class ExercisesController < ApplicationController
|
|||||||
case user_intervention_group
|
case user_intervention_group
|
||||||
when :no_intervention
|
when :no_intervention
|
||||||
when :break_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
|
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
|
end
|
||||||
|
|
||||||
@search = Search.new
|
@search = Search.new
|
||||||
|
@ -27,7 +27,7 @@ class ExternalUsersController < ApplicationController
|
|||||||
score,
|
score,
|
||||||
id,
|
id,
|
||||||
CASE
|
CASE
|
||||||
WHEN working_time >= '0:30:00' THEN '0'
|
WHEN working_time >= '0:05:00' THEN '0'
|
||||||
ELSE working_time
|
ELSE working_time
|
||||||
END AS working_time_new
|
END AS working_time_new
|
||||||
FROM
|
FROM
|
||||||
|
@ -67,7 +67,7 @@ class Exercise < ActiveRecord::Base
|
|||||||
sum(working_time_new) AS working_time
|
sum(working_time_new) AS working_time
|
||||||
FROM
|
FROM
|
||||||
(SELECT user_id,
|
(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
|
FROM
|
||||||
(SELECT user_id,
|
(SELECT user_id,
|
||||||
id,
|
id,
|
||||||
@ -169,7 +169,7 @@ class Exercise < ActiveRecord::Base
|
|||||||
exercise_id,
|
exercise_id,
|
||||||
max_score,
|
max_score,
|
||||||
CASE
|
CASE
|
||||||
WHEN working_time >= '0:30:00' THEN '0'
|
WHEN working_time >= '0:05:00' THEN '0'
|
||||||
ELSE working_time
|
ELSE working_time
|
||||||
END AS working_time_new
|
END AS working_time_new
|
||||||
FROM all_working_times_until_max ), result AS
|
FROM all_working_times_until_max ), result AS
|
||||||
@ -263,7 +263,7 @@ class Exercise < ActiveRecord::Base
|
|||||||
|
|
||||||
FILTERED_TIMES_UNTIL_MAX AS
|
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
|
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
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_user_solved(user)
|
||||||
|
return maximum_score(user).to_i == maximum_score.to_i
|
||||||
|
end
|
||||||
|
|
||||||
def set_default_values
|
def set_default_values
|
||||||
set_default_values_if_present(public: false)
|
set_default_values_if_present(public: false)
|
||||||
end
|
end
|
||||||
|
@ -5,5 +5,7 @@ h5 = t('exercises.implement.comment.question')
|
|||||||
textarea.form-control#question(style='resize:none;')
|
textarea.form-control#question(style='resize:none;')
|
||||||
p = ''
|
p = ''
|
||||||
/ data-cause='requestComments' is not used here right now, we pass the button #requestComments (not askForCommentsButton) as initiator of the action.
|
/ 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
|
/ But if we use this button, it will work since the correct cause is supplied
|
||||||
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')
|
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
|
username: Benutzername
|
||||||
requested_at: Angefragezeitpunkt
|
requested_at: Angefragezeitpunkt
|
||||||
question: "Frage"
|
question: "Frage"
|
||||||
|
close: "Fenster schließen"
|
||||||
submission:
|
submission:
|
||||||
cause: Anlass
|
cause: Anlass
|
||||||
code: Code
|
code: Code
|
||||||
@ -279,7 +280,7 @@ de:
|
|||||||
request: "Kommentaranfrage stellen"
|
request: "Kommentaranfrage stellen"
|
||||||
question: "Bitte beschreiben Sie kurz ihre Probleme oder nennen Sie den Programmteil, zu dem Sie Feedback wünschen."
|
question: "Bitte beschreiben Sie kurz ihre Probleme oder nennen Sie den Programmteil, zu dem Sie Feedback wünschen."
|
||||||
rfc_intervention:
|
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:
|
break_intervention:
|
||||||
title: "Pause"
|
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?"
|
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
|
username: Username
|
||||||
requested_at: Request Date
|
requested_at: Request Date
|
||||||
question: "Question"
|
question: "Question"
|
||||||
|
close: Close window
|
||||||
submission:
|
submission:
|
||||||
cause: Cause
|
cause: Cause
|
||||||
code: Code
|
code: Code
|
||||||
|
Reference in New Issue
Block a user