From c23411cc6915ec692fc9b08680cb1a155e65fc76 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 12 Feb 2019 13:17:29 -0500 Subject: [PATCH] FIX: Heisentest - suspicious logins report was not ordered by date The specs needed an order even though none was supplied. --- app/models/report.rb | 1 + spec/models/report_spec.rb | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/report.rb b/app/models/report.rb index f7540b71eba..5d1d1a22d4a 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -1441,6 +1441,7 @@ class Report WHERE t.action = 'suspicious' AND t.created_at >= :start_date AND t.created_at <= :end_date + ORDER BY t.created_at DESC SQL DB.query(sql, start_date: report.start_date, end_date: report.end_date).each do |row| diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb index 76896b4919f..11437020243 100644 --- a/spec/models/report_spec.rb +++ b/spec/models/report_spec.rb @@ -1006,11 +1006,10 @@ describe Report do context "with data" do it "works" do SiteSetting.verbose_auth_token_logging = true - freeze_time DateTime.parse('2017-03-01 12:00') - UserAuthToken.log(action: "suspicious", user_id: robin.id) - UserAuthToken.log(action: "suspicious", user_id: joffrey.id) - UserAuthToken.log(action: "suspicious", user_id: joffrey.id) + UserAuthToken.log(action: "suspicious", user_id: joffrey.id, created_at: 2.hours.ago) + UserAuthToken.log(action: "suspicious", user_id: joffrey.id, created_at: 3.hours.ago) + UserAuthToken.log(action: "suspicious", user_id: robin.id, created_at: 1.hour.ago) report = Report.find("suspicious_logins")