Make test for a "zero hour" block more robust
authorSimon Poole <simon@poole.ch>
Sat, 18 Feb 2017 16:05:36 +0000 (17:05 +0100)
committerSimon Poole <simon@poole.ch>
Sat, 18 Feb 2017 16:05:36 +0000 (17:05 +0100)
app/models/user_block.rb

index edea23c80aad2547c8c369e2e4a18d9d29d4f92c..eb0daba6569731cad0fe0486b6ea814099e6d2d5 100644 (file)
@@ -29,7 +29,8 @@ class UserBlock < ActiveRecord::Base
   ##
   # returns true if the block is a "zero hour" block
   def zero_hour?
-    needs_view && (ends_at.to_i == updated_at.to_i)
+    # if the times differ more than 1 minute we probably have more important issues
+    needs_view && (ends_at.to_i - updated_at.to_i) < 60
   end
 
   ##