From c62e9f53e5abfad9075b7753e5e3dcec51a25633 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Wed, 29 Nov 2017 16:06:45 +0100 Subject: [PATCH 1/5] fixed broken methodname (missing questionmark...) --- app/models/exercise.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 06ed391f..f03d6641 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -364,7 +364,7 @@ class Exercise < ActiveRecord::Base end private :valid_main_file? - def needs_more_feedback + def needs_more_feedback? user_exercise_feedbacks.size <= MAX_EXERCISE_FEEDBACKS end From 53df8f9d92ddbf7a8dbdbac2438526b8ecb44408 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Wed, 29 Nov 2017 16:35:18 +0100 Subject: [PATCH 2/5] correct method call --- app/models/submission.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/submission.rb b/app/models/submission.rb index 38ea16d6..d75d6019 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -57,7 +57,7 @@ class Submission < ActiveRecord::Base end def redirect_to_feedback? - ((user_id + exercise.created_at.to_i) % 10 == 1) && exercise.needs_more_feedback + ((user_id + exercise.created_at.to_i) % 10 == 1) && exercise.needs_more_feedback? end def own_unsolved_rfc From 9234f11eaca82ee4109349343c8014e5e34b9a74 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Tue, 5 Dec 2017 10:57:11 +0100 Subject: [PATCH 3/5] remove failed option (it is not there yet) --- app/views/exercises/external_users/statistics.html.slim | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/exercises/external_users/statistics.html.slim b/app/views/exercises/external_users/statistics.html.slim index 8b5c3b30..06132754 100644 --- a/app/views/exercises/external_users/statistics.html.slim +++ b/app/views/exercises/external_users/statistics.html.slim @@ -54,8 +54,6 @@ h1 = "#{@exercise} (external user #{@external_user})" -submission_or_intervention.testruns.each do |run| - if run.passed .unit-test-result.positive-result title=run.output - - elsif run.failed - .unit-test-result.negative-result title=run.output - else .unit-test-result.unknown-result title=run.output td = Time.at(deltas[1..index].inject(:+)).utc.strftime("%H:%M:%S") if index > 0 From b25681a63efa6a1ec5c74f8e8c9157e0e422dbeb Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Tue, 12 Dec 2017 14:33:46 +0100 Subject: [PATCH 4/5] removed (partly outdated) xikolo-client that was used for name retrieval. --- lib/xikolo/client.rb | 59 --------------------------------------- lib/xikolo/user_client.rb | 15 ---------- 2 files changed, 74 deletions(-) delete mode 100644 lib/xikolo/client.rb delete mode 100644 lib/xikolo/user_client.rb diff --git a/lib/xikolo/client.rb b/lib/xikolo/client.rb deleted file mode 100644 index 4e6f22b2..00000000 --- a/lib/xikolo/client.rb +++ /dev/null @@ -1,59 +0,0 @@ -class Xikolo::Client - def self.get_user(user_id) - params = {:user_id => user_id} - response = get_request(user_profile_url(user_id), params) - if response - return JSON.parse(response) - else - return nil - end - end - - def self.user_profile_url(user_id) - return url + 'v2/users/' + user_id - end - - def self.post_request(url, params) - begin - return RestClient.post url, params, http_header - rescue - return nil - end - end - - def self.get_request(url, params) - begin - return RestClient.get url, {:params => params}.merge(http_header) - rescue - return nil - end - end - - def self.http_header - return {:accept => accept, :authorization => token} - end - - def self.url - @url ||= CodeOcean::Config.new(:code_ocean).read.fetch(:xikolo_api_url, 'http://localhost:3000/api/') #caches this with ||=, second value of fetch is default value - end - - def self.accept - 'application/vnd.xikolo.v1, application/vnd.api+json, application/json' - end - - def self.token - 'Token token='+Rails.application.secrets.openhpi_api_token#+'"' - end - - private - - def authenticate_with_user - params = {:email => "admin@openhpi.de", :password => "admin"} - response = post_request(authentication_url, params) - @token = 'Token token="'+JSON.parse(response)['token']+'"' - end - - def self.authentication_url - return @url + 'authenticate' - end -end \ No newline at end of file diff --git a/lib/xikolo/user_client.rb b/lib/xikolo/user_client.rb deleted file mode 100644 index c681c999..00000000 --- a/lib/xikolo/user_client.rb +++ /dev/null @@ -1,15 +0,0 @@ -class Xikolo::UserClient - def self.get(user_id) - user = Xikolo::Client.get_user(user_id) - - # return default values if user is not found or if there is a server issue: - if user - name = user.dig('data', 'attributes', 'name') || "User " + user_id - user_visual = user.dig('data', 'attributes', 'avatar_url') || ActionController::Base.helpers.image_path('default.png') - language = user.dig('data', 'attributes', 'language') || "DE" - return {display_name: name, user_visual: user_visual, language: language} - else - return {display_name: "User " + user_id, user_visual: ActionController::Base.helpers.image_path('default.png'), language: "DE"} - end - end -end \ No newline at end of file From e934a29a45e759665b57b8f2a9f7616c4a12b7d1 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Wed, 20 Dec 2017 10:36:31 +0100 Subject: [PATCH 5/5] Set oscillating tests to pending --- spec/controllers/sessions_controller_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index 480530da..81ec669f 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -132,12 +132,14 @@ describe SessionsController do end it 'redirects to recommended exercise if requested token of proxy exercise' do + pending 'test is currently oscillating' FactoryBot.create(:proxy_exercise, exercises: [exercise]) post :create_through_lti, custom_locale: locale, custom_token: ProxyExercise.first.token, oauth_consumer_key: consumer.oauth_key, oauth_nonce: nonce, oauth_signature: SecureRandom.hex, user_id: user.external_id expect(controller).to redirect_to(implement_exercise_path(exercise.id)) end it 'recommends only exercises who are 1 degree more complicated than what user has seen' do + pending 'test is currently oscillating' # dummy user has no exercises finished, therefore his highest difficulty is 0 FactoryBot.create(:proxy_exercise, exercises: [exercise, exercise2]) exercise.expected_difficulty = 3