• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AgileVentures / WebsiteOne / #246

13 Dec 2022 07:22PM UTC coverage: 68.636% (-0.2%) from 68.876%
#246

push

web-flow
Merge pull request #3814 from mattlindsey/3805_testing_updates

Replace jasmine gem and phantomjs

1057 of 1540 relevant lines covered (68.64%)

1.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.0
/app/models/event_instance.rb
1
# frozen_string_literal: true
2

3
class EventInstance < ApplicationRecord
1✔
4
  self.per_page = 30
1✔
5

6
  belongs_to :event, optional: true
1✔
7
  delegate :within_current_event_duration?, to: :event
1✔
8

9
  belongs_to :user, optional: true
1✔
10
  belongs_to :project, optional: true
1✔
11
  include UserNullable
1✔
12

13
  serialize :participants
1✔
14

15
  scope :started, -> { where.not(hangout_url: nil) }
1✔
16
  scope :live, -> { where('updated_at > ?', 5.minutes.ago).order('created_at DESC') }
1✔
17
  scope :latest, -> { order('created_at DESC') }
1✔
18
  scope :pp_hangouts, -> { where(category: 'PairProgramming') }
1✔
19

20
  has_many :hangout_participants_snapshots
1✔
21
  accepts_nested_attributes_for :hangout_participants_snapshots
1✔
22

23
  def for
1✔
24
    event&.for
×
25
  end
26

27
  def self.active_hangouts
1✔
28
    select(&:live?)
×
29
  end
30

31
  def started?
1✔
32
    hangout_url?
×
33
  end
34

35
  def updated_within_last_two_minutes?
1✔
36
    updated_at > 2.minutes.ago
×
37
  end
38

39
  # margin: Seconds for which condition can be relaxed for start time
40
  def updated_within_current_event_duration?(margin)
1✔
41
    return false unless event.current_start_time
×
42

43
    updated_at > (event.current_start_time - margin) &&
×
44
      updated_at < event.current_end_time
45
  end
46

47
  def live?
1✔
48
    return false if !started? || hoa_status == 'finished'
×
49
    return true if updated_within_last_two_minutes?
×
50

51
    url_set_directly && updated_within_current_event_duration?(600) &&
×
52
      event.before_current_end_time?
53
  end
54

55
  def duration
1✔
56
    updated_at - created_at
×
57
  end
58

59
  def start_datetime
1✔
60
    event.nil? ? created_at : event.start_datetime
×
61
  end
62

63
  def broadcaster
1✔
64
    participants&.each do |_, hash|
×
65
      break hash['person']['displayName'] if hash['isBroadcaster'] == 'true'
×
66
    end
67
  end
68

69
  def yt_url
1✔
70
    yt_video_id && "https://youtu.be/#{yt_video_id}"
×
71
  end
72

73
  def channels_for_event
1✔
74
    return [] if event_id.nil?
×
75

76
    event = Event.find(event_id)
×
77
    event.slack_channel_codes
×
78
  end
79

80
  private
1✔
81

82
  def manually_updated_event_not_finished?
1✔
83
    url_set_directly && within_current_event_duration?
×
84
  end
85
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc