Skip to content

Commit e2f0ded

Browse files
committed
Fix Rubocop offenses
1 parent 337e83e commit e2f0ded

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

app/helpers/statistics_helper.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ def exercise_statistics
7171
{
7272
key: 'submissions_per_minute',
7373
name: t('statistics.entries.exercises.submissions_per_minute'),
74-
data: (Submission.where(created_at: DateTime.now - 1.hour..).count.to_f / 60).round(2),
74+
data: (Submission.where(created_at: (DateTime.now - 1.hour)..).count.to_f / 60).round(2),
7575
unit: '/min',
7676
url: statistics_graphs_path,
7777
},
7878
{
7979
key: 'autosaves_per_minute',
8080
name: t('statistics.entries.exercises.autosaves_per_minute'),
81-
data: (Submission.where(created_at: DateTime.now - 1.hour..).where(cause: 'autosave').count.to_f / 60).round(2),
81+
data: (Submission.where(created_at: (DateTime.now - 1.hour)..).where(cause: 'autosave').count.to_f / 60).round(2),
8282
unit: '/min',
8383
},
8484
{
8585
key: 'container_requests_per_minute',
8686
name: t('statistics.entries.exercises.container_requests_per_minute'),
8787
# This query is actually quite expensive since we do not have an index on the created_at column.
88-
data: (Testrun.where(created_at: DateTime.now - 1.hour..).count.to_f / 60).round(2),
88+
data: (Testrun.where(created_at: (DateTime.now - 1.hour)..).count.to_f / 60).round(2),
8989
unit: '/min',
9090
},
9191
{
@@ -118,12 +118,12 @@ def user_activity_live_data
118118
{
119119
key: 'active_in_last_hour',
120120
name: t('statistics.entries.contributors.currently_active'),
121-
data: Submission.where(created_at: DateTime.now - 5.minutes..).distinct.select(:contributor_id, :contributor_type).count,
121+
data: Submission.where(created_at: (DateTime.now - 5.minutes)..).distinct.select(:contributor_id, :contributor_type).count,
122122
},
123123
{
124124
key: 'submissions_per_minute',
125125
name: t('statistics.entries.exercises.submissions_per_minute'),
126-
data: (Submission.where(created_at: DateTime.now - 1.hour..).count.to_f / 60).round(2),
126+
data: (Submission.where(created_at: (DateTime.now - 1.hour)..).count.to_f / 60).round(2),
127127
unit: '/min',
128128
axis: 'right',
129129
},

app/models/event/synchronized_editor.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ def self.data_attribute(event, delta)
9191
event.presence if event.present? # TODO: As of now, we are storing the `session_id` most of the times. Intended?
9292
end
9393
private_class_method :data_attribute
94-
end
9594

96-
private
95+
private
9796

98-
def lines_not_nil
99-
if lines.nil?
100-
errors.add(:lines, 'cannot be nil')
97+
def lines_not_nil
98+
if lines.nil?
99+
errors.add(:lines, 'cannot be nil')
100+
end
101101
end
102102
end

0 commit comments

Comments
 (0)