Use Ruby syntax instead of SQL snippets for Testrun queries
This commit is contained in:
@ -6,7 +6,7 @@ class FlowrController < ApplicationController
|
|||||||
# get the latest submission for this user that also has a test run (i.e. structured_errors if applicable)
|
# get the latest submission for this user that also has a test run (i.e. structured_errors if applicable)
|
||||||
submission = Submission.joins(:testruns)
|
submission = Submission.joins(:testruns)
|
||||||
.where(submissions: {user_id: current_user.id, user_type: current_user.class.name})
|
.where(submissions: {user_id: current_user.id, user_type: current_user.class.name})
|
||||||
.order('testruns.created_at DESC').first
|
.order(testruns: {created_at: :desc}).first
|
||||||
|
|
||||||
# Return if no submission was found
|
# Return if no submission was found
|
||||||
if submission.blank? || @embed_options[:disable_hints] || @embed_options[:hide_test_results]
|
if submission.blank? || @embed_options[:disable_hints] || @embed_options[:hide_test_results]
|
||||||
|
@ -79,7 +79,7 @@ module StatisticsHelper
|
|||||||
{
|
{
|
||||||
key: 'container_requests_per_minute',
|
key: 'container_requests_per_minute',
|
||||||
name: t('statistics.entries.exercises.container_requests_per_minute'),
|
name: t('statistics.entries.exercises.container_requests_per_minute'),
|
||||||
data: (Testrun.where('created_at >= ?', DateTime.now - 1.hour).count.to_f / 60).round(2),
|
data: (Testrun.where(created_at: DateTime.now - 1.hour..).count.to_f / 60).round(2),
|
||||||
unit: '/min',
|
unit: '/min',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user