mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
24 lines
461 B
Ruby
24 lines
461 B
Ruby
# frozen_string_literal: true
|
|
|
|
class VisitDraft
|
|
attr_accessor :start_time, :end_time, :points
|
|
|
|
def initialize(start_time)
|
|
@start_time = start_time
|
|
@end_time = start_time
|
|
@points = []
|
|
end
|
|
|
|
def add_point(point)
|
|
@points << point
|
|
@end_time = point.timestamp if point.timestamp > @end_time
|
|
end
|
|
|
|
def duration_in_minutes
|
|
(end_time - start_time) / 60.0
|
|
end
|
|
|
|
def valid?
|
|
@points.size > 1 && duration_in_minutes >= 10
|
|
end
|
|
end
|