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

AgileVentures / WebsiteOne / #247

13 Dec 2022 07:22PM UTC coverage: 67.547% (-1.1%) from 68.636%
#247

push

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

Replace jasmine gem and phantomjs

1228 of 1818 relevant lines covered (67.55%)

1.14 hits per line

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

59.09
/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

1✔
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') }
18
  scope :pp_hangouts, -> { where(category: 'PairProgramming') }
1✔
19

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

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

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

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

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

1✔
39
  # margin: Seconds for which condition can be relaxed for start time
×
40
  def updated_within_current_event_duration?(margin)
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
1✔
46

×
47
  def live?
×
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
1✔
54

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

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

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

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

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

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

80
  private
1✔
81

×
82
  def manually_updated_event_not_finished?
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