File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ def can_overlap?(other_session)
64
64
end
65
65
66
66
def round_to_nearest_minute ( time )
67
- time + ( ( 30 - time . sec ) / 60 * 60 )
67
+ Time . at ( ( time . to_f / 60 ) . round * 60 ) . utc
68
68
end
69
69
70
70
def set_recorded_hours
Original file line number Diff line number Diff line change @@ -81,8 +81,8 @@ class TimerSessionTest < ActiveSupport::TestCase
81
81
timer_start : base_time + 1 . hour + 5 . seconds ,
82
82
timer_end : base_time + 2 . hours )
83
83
84
- assert_not session1 . overlaps? ( session2 )
85
- assert_not session2 . overlaps? ( session1 )
84
+ assert session1 . overlaps? ( session2 )
85
+ assert session2 . overlaps? ( session1 )
86
86
87
87
session1 = FactoryBot . create ( :timer_session , user : User . current ,
88
88
timer_start : base_time ,
@@ -91,7 +91,7 @@ class TimerSessionTest < ActiveSupport::TestCase
91
91
timer_start : base_time + 1 . hour ,
92
92
timer_end : base_time + 2 . hours )
93
93
94
- assert session1 . overlaps? ( session2 )
95
- assert session2 . overlaps? ( session1 )
94
+ assert_not session1 . overlaps? ( session2 )
95
+ assert_not session2 . overlaps? ( session1 )
96
96
end
97
97
end
You can’t perform that action at this time.
0 commit comments