Merge branch 'master' into lti_param_model

This commit is contained in:
Tom Staubitz
2016-12-27 00:16:32 +01:00
5 changed files with 49 additions and 10 deletions

View File

@ -351,7 +351,7 @@ configureEditors: function () {
}, },
isBrowserSupported: function () { isBrowserSupported: function () {
// websockets is used for run, score and test // websockets are used for run, score and test
return Modernizr.websockets; return Modernizr.websockets;
}, },
@ -361,7 +361,7 @@ configureEditors: function () {
panel.find('.panel-title .number').text(index + 1); panel.find('.panel-title .number').text(index + 1);
panel.find('.row .col-sm-9').eq(0).find('.number').eq(0).text(result.passed); panel.find('.row .col-sm-9').eq(0).find('.number').eq(0).text(result.passed);
panel.find('.row .col-sm-9').eq(0).find('.number').eq(1).text(result.count); panel.find('.row .col-sm-9').eq(0).find('.number').eq(1).text(result.count);
panel.find('.row .col-sm-9').eq(1).find('.number').eq(0).text((result.score * result.weight).toFixed(2)); panel.find('.row .col-sm-9').eq(1).find('.number').eq(0).text(parseFloat((result.score * result.weight).toFixed(2)));
panel.find('.row .col-sm-9').eq(1).find('.number').eq(1).text(result.weight); panel.find('.row .col-sm-9').eq(1).find('.number').eq(1).text(result.weight);
panel.find('.row .col-sm-9').eq(2).text(result.message); panel.find('.row .col-sm-9').eq(2).text(result.message);
if (result.error_messages) panel.find('.row .col-sm-9').eq(3).text(result.error_messages.join(', ')); if (result.error_messages) panel.find('.row .col-sm-9').eq(3).text(result.error_messages.join(', '));

View File

@ -6,6 +6,7 @@ CodeOceanEditorEvaluation = {
*/ */
scoreCode: function (event) { scoreCode: function (event) {
event.preventDefault(); event.preventDefault();
this.clearScoringOutput();
this.createSubmission('#assess', null, function (response) { this.createSubmission('#assess', null, function (response) {
this.showSpinner($('#assess')); this.showSpinner($('#assess'));
$('#score_div').removeClass('hidden'); $('#score_div').removeClass('hidden');
@ -139,6 +140,14 @@ CodeOceanEditorEvaluation = {
$('#output pre').remove(); $('#output pre').remove();
}, },
clearScoringOutput: function() {
$('#results ul').first().html('');
$('.test-count .number').html(0);
$('#score').data('score', 0);
this.renderScore();
this.clearOutput();
},
printOutput: function (output, colorize, index) { printOutput: function (output, colorize, index) {
var element = this.findOrCreateOutputElement(index); var element = this.findOrCreateOutputElement(index);
if (!colorize) { if (!colorize) {

View File

@ -265,7 +265,7 @@ class ExercisesController < ApplicationController
return return
# else: show open rfc for same exercise if available # else: show open rfc for same exercise if available
elsif rfc = RequestForComment.unsolved.where(exercise_id: @submission.exercise).order("RANDOM()").first elsif rfc = RequestForComment.unsolved.where(exercise_id: @submission.exercise).where.not(question: nil).order("RANDOM()").first
# set a message that informs the user that his score was perfect and help in RFC is greatly appreciated. # 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[:notice] = I18n.t('exercises.submit.full_score_redirect_to_rfc')
flash.keep(:notice) flash.keep(:notice)

View File

@ -6,7 +6,9 @@
submission = @request_for_comment.submission submission = @request_for_comment.submission
%> %>
<%= 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>
@ -25,6 +27,20 @@
<% else %> <% else %>
<% end %> <% end %>
<% if @current_user.admin? && user.is_a?(ExternalUser) %>
<br>
<br>
<h4>Admin Menu</h4>
<h5>
<ul>
<li><%= link_to "User's current status of this exercise", statistics_external_user_exercise_path(id: @request_for_comment.exercise_id, external_user_id: @request_for_comment.user_id) %></li>
<li><%= link_to "All exercises of this user", statistics_external_user_path(id: @request_for_comment.user_id) %></li> <br>
<li><%= link_to "Implement the exercise yourself", implement_exercise_path(id: @request_for_comment.exercise_id) %> </li>
<li><%= link_to "Show the exercise", exercise_path(id: @request_for_comment.exercise_id) %> </li>
</ul>
</h5>
<% end %>
</div> </div>
<!-- <!--

View File

@ -1,14 +1,17 @@
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests. # true: Code is not reloaded between requests.
config.cache_classes = true # false: In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Eager load code on boot. This eager loads most of Rails and # true: Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers # your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better. # and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance. # Rake tasks automatically ignore this option for performance.
config.eager_load = true config.eager_load = false
#enable web console in staging #enable web console in staging
config.web_console.development_only = false config.web_console.development_only = false
@ -17,6 +20,17 @@ Rails.application.configure do
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raise errors for missing translations.
config.action_view.raise_on_missing_translations = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application # Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this. # Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.