Merge branch 'master' into editor-frontend-refactor
Conflicts: app/assets/javascripts/editor.js.erb ---> kept refactored one
This commit is contained in:
@ -224,7 +224,7 @@ class ExercisesController < ApplicationController
|
|||||||
if lti_outcome_service?
|
if lti_outcome_service?
|
||||||
transmit_lti_score
|
transmit_lti_score
|
||||||
else
|
else
|
||||||
redirect_to_lti_return_path
|
redirect_after_submit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ class ExercisesController < ApplicationController
|
|||||||
::NewRelic::Agent.add_custom_parameters({ submission: @submission.id, normalized_score: @submission.normalized_score })
|
::NewRelic::Agent.add_custom_parameters({ submission: @submission.id, normalized_score: @submission.normalized_score })
|
||||||
response = send_score(@submission.normalized_score)
|
response = send_score(@submission.normalized_score)
|
||||||
if response[:status] == 'success'
|
if response[:status] == 'success'
|
||||||
redirect_to_lti_return_path
|
redirect_after_submit
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to(implement_exercise_path(@submission.exercise)) }
|
format.html { redirect_to(implement_exercise_path(@submission.exercise)) }
|
||||||
@ -245,4 +245,28 @@ class ExercisesController < ApplicationController
|
|||||||
def update
|
def update
|
||||||
update_and_respond(object: @exercise, params: exercise_params)
|
update_and_respond(object: @exercise, params: exercise_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def redirect_after_submit
|
||||||
|
Rails.logger.debug('Score ' + @submission.normalized_score.to_s)
|
||||||
|
if @submission.normalized_score == 1.0
|
||||||
|
# if user has an own rfc, redirect to it and message him to clean up and accept the answer.
|
||||||
|
|
||||||
|
# else: show open rfc for same exercise
|
||||||
|
if rfc = RequestForComment.unsolved.where(exercise_id: @submission.exercise).order("RANDOM()").first
|
||||||
|
|
||||||
|
# set a message that informs the user that his score was perfect and help in RFC is greatly appreciated.
|
||||||
|
flash[:notice] = I18n.t('exercises.submit.full_score_redirect_to_rfc')
|
||||||
|
flash.keep(:notice)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to(rfc) }
|
||||||
|
format.json { render(json: {redirect: url_for(rfc)}) }
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
redirect_to_lti_return_path
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -4,16 +4,12 @@ class RequestForComment < ActiveRecord::Base
|
|||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
belongs_to :file, class_name: 'CodeOcean::File'
|
belongs_to :file, class_name: 'CodeOcean::File'
|
||||||
|
|
||||||
before_create :set_requested_timestamp
|
scope :unsolved, -> { where(solved: [false, nil]) }
|
||||||
|
|
||||||
def self.last_per_user(n = 5)
|
def self.last_per_user(n = 5)
|
||||||
from("(#{row_number_user_sql}) as request_for_comments").where("row_number <= ?", n)
|
from("(#{row_number_user_sql}) as request_for_comments").where("row_number <= ?", n)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_requested_timestamp
|
|
||||||
self.requested_at = Time.now
|
|
||||||
end
|
|
||||||
|
|
||||||
# not used right now, finds the last submission for the respective user and exercise.
|
# not used right now, finds the last submission for the respective user and exercise.
|
||||||
# might be helpful to check whether the exercise has been solved in the meantime.
|
# might be helpful to check whether the exercise has been solved in the meantime.
|
||||||
def last_submission
|
def last_submission
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
h5 =t('exercises.implement.comment.others')
|
|
||||||
pre#other-comments
|
|
||||||
|
|
||||||
h5 =t('exercises.implement.comment.addyours')
|
h5 =t('exercises.implement.comment.addyours')
|
||||||
|
|
||||||
textarea.form-control(style='resize:none;')
|
textarea.form-control(style='resize:none;')
|
||||||
|
#otherComments
|
||||||
|
h5 =t('exercises.implement.comment.others')
|
||||||
|
pre#otherCommentsTextfield
|
||||||
p = ''
|
p = ''
|
||||||
button#addCommentButton.btn.btn-block.btn-primary(type='button') =t('exercises.implement.comment.addComment')
|
button#addCommentButton.btn.btn-block.btn-primary(type='button') =t('exercises.implement.comment.addComment')
|
||||||
button#removeAllButton.btn.btn-block.btn-warning(type='button') =t('exercises.implement.comment.removeAllOnLine')
|
button#removeAllButton.btn.btn-block.btn-warning(type='button') =t('exercises.implement.comment.removeAllOnLine')
|
@ -23,10 +23,6 @@
|
|||||||
<%= f.label :file_id %><br>
|
<%= f.label :file_id %><br>
|
||||||
<%= f.number_field :file_id %>
|
<%= f.number_field :file_id %>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
|
||||||
<%= f.label :requested_at %><br>
|
|
||||||
<%= f.datetime_select :requested_at %>
|
|
||||||
</div>
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :user_type %><br>
|
<%= f.label :user_type %><br>
|
||||||
<%= f.text_field :user_type %>
|
<%= f.text_field :user_type %>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
json.array!(@request_for_comments) do |request_for_comment|
|
json.array!(@request_for_comments) do |request_for_comment|
|
||||||
json.extract! request_for_comment, :id, :user_id, :exercise_id, :file_id, :requested_at, :user_type
|
json.extract! request_for_comment, :id, :user_id, :exercise_id, :file_id, :user_type
|
||||||
json.url request_for_comment_url(request_for_comment, format: :json)
|
json.url request_for_comment_url(request_for_comment, format: :json)
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<%= user.displayname %> | <%= @request_for_comment.created_at.localtime %>
|
<%= user.displayname %> | <%= @request_for_comment.created_at.localtime %>
|
||||||
</p>
|
</p>
|
||||||
<h5>
|
<h5>
|
||||||
<u><%= t('activerecord.attributes.exercise.description') %>:</u> "<%= render_markdown(@request_for_comment.exercise.description) %>"
|
<u><%= t('activerecord.attributes.exercise.description') %>:</u> <%= render_markdown(@request_for_comment.exercise.description) %>
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
<h5>
|
<h5>
|
||||||
@ -162,9 +162,10 @@ also, all settings from the rails model needed for the editor configuration in t
|
|||||||
if (hasCommentsInRow(editor, row)) {
|
if (hasCommentsInRow(editor, row)) {
|
||||||
var rowComments = getCommentsForRow(editor, row);
|
var rowComments = getCommentsForRow(editor, row);
|
||||||
var comments = _.pluck(rowComments, 'text').join('\n');
|
var comments = _.pluck(rowComments, 'text').join('\n');
|
||||||
commentModal.find('#other-comments').text(comments);
|
commentModal.find('#otherComments').show();
|
||||||
|
commentModal.find('#otherCommentsTextfield').text(comments);
|
||||||
} else {
|
} else {
|
||||||
commentModal.find('#other-comments').text('none');
|
commentModal.find('#otherComments').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
commentModal.find('#addCommentButton').off('click');
|
commentModal.find('#addCommentButton').off('click');
|
||||||
|
@ -1 +1 @@
|
|||||||
json.extract! @request_for_comment, :id, :user_id, :exercise_id, :file_id, :requested_at, :created_at, :updated_at, :user_type, :solved
|
json.extract! @request_for_comment, :id, :user_id, :exercise_id, :file_id, :created_at, :updated_at, :user_type, :solved
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
server '10.210.0.50', roles: [:app, :db, :puma_nginx, :web], user: 'debian'
|
server '10.210.0.50', roles: [:app, :db, :puma_nginx, :web], user: 'debian'
|
||||||
set :rails_env, "staging"
|
set :rails_env, "staging"
|
||||||
|
set :branch, ENV['BRANCH'] if ENV['BRANCH']
|
||||||
|
@ -252,7 +252,7 @@ de:
|
|||||||
comment:
|
comment:
|
||||||
a_comment: Kommentar
|
a_comment: Kommentar
|
||||||
line: Zeile
|
line: Zeile
|
||||||
dialogtitle: Kommentieren Sie diese Zeile!
|
dialogtitle: Kommentar hinzufügen
|
||||||
others: Andere Kommentare auf dieser Zeile
|
others: Andere Kommentare auf dieser Zeile
|
||||||
addyours: Fügen Sie Ihren Kommentar hinzu
|
addyours: Fügen Sie Ihren Kommentar hinzu
|
||||||
addComment: Kommentieren
|
addComment: Kommentieren
|
||||||
@ -279,6 +279,7 @@ de:
|
|||||||
external_user: Externe Nutzer
|
external_user: Externe Nutzer
|
||||||
submit:
|
submit:
|
||||||
failure: Beim Übermitteln Ihrer Punktzahl ist ein Fehler aufgetreten. Bitte versuchen Sie es später erneut.
|
failure: Beim Übermitteln Ihrer Punktzahl ist ein Fehler aufgetreten. Bitte versuchen Sie es später erneut.
|
||||||
|
full_score_redirect_to_rfc: Herzlichen Glückwunsch! Sie haben die maximale Punktzahl für diese Aufgabe an den Kurs übertragen. Ein anderer Teilnehmer hat eine Frage zu der von Ihnen gelösten Aufgabe. Er würde sich sicherlich sehr über ihre Hilfe und Kommentare freuen.
|
||||||
external_users:
|
external_users:
|
||||||
statistics:
|
statistics:
|
||||||
no_data_available: Keine Daten verfügbar.
|
no_data_available: Keine Daten verfügbar.
|
||||||
|
@ -252,7 +252,7 @@ en:
|
|||||||
comment:
|
comment:
|
||||||
a_comment: comment
|
a_comment: comment
|
||||||
line: line
|
line: line
|
||||||
dialogtitle: Comment on this line!
|
dialogtitle: Comment on this line
|
||||||
others: Other comments on this line
|
others: Other comments on this line
|
||||||
addyours: Add your comment
|
addyours: Add your comment
|
||||||
addComment: Comment this
|
addComment: Comment this
|
||||||
@ -279,6 +279,7 @@ en:
|
|||||||
external_users: External Users
|
external_users: External Users
|
||||||
submit:
|
submit:
|
||||||
failure: An error occured while transmitting your score. Please try again later.
|
failure: An error occured while transmitting your score. Please try again later.
|
||||||
|
full_score_redirect_to_rfc: Congratulations! You achieved and submitted the highest possible score for this exercise. Another participant has a question concerning the exercise you just solved. Your help and comments will be greatly appreciated!
|
||||||
external_users:
|
external_users:
|
||||||
statistics:
|
statistics:
|
||||||
no_data_available: No data available.
|
no_data_available: No data available.
|
||||||
|
Reference in New Issue
Block a user