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

pulibrary / tigerdata-app / 1f9ee909-20b2-467d-b493-b5be4964430d

22 Oct 2025 04:57PM UTC coverage: 91.212%. Remained the same
1f9ee909-20b2-467d-b493-b5be4964430d

push

circleci

web-flow
Fixing flaky tests (#2080)

10 times out of 10 one of these tests would fail for me locally.

Really we just have to look at the page for something new so that we are
sure the controller action has finished before we check for something
that is not waiting.

2740 of 3004 relevant lines covered (91.21%)

755.12 hits per line

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

100.0
/app/presenters/project_show_presenter.rb
1
# frozen_string_literal: true
2
class ProjectShowPresenter
4✔
3
  delegate "id", "in_mediaflux?", "mediaflux_id", "status", "title", to: :project
4✔
4
  delegate "description", "project_id", "storage_performance_expectations", "project_purpose", to: :project_metadata
4✔
5

6
  attr_reader :project, :project_metadata
4✔
7

8
  # @return [Class] The presenter class for building XML Documents from Projects
9
  def self.xml_presenter_class
4✔
10
    ProjectXmlPresenter
18✔
11
  end
12

13
  def initialize(project)
4✔
14
    @project = project
331✔
15
    @project_metadata = @project.metadata_model
331✔
16
  end
17

18
  # @return [String] the XML for the project Document 
19
  def to_xml
4✔
20
    xml_document.to_xml
16✔
21
  end
22

23
  # @return [Nokogiri::XML::Document] the XML Document for the Project
24
  def xml_document
4✔
25
    @xml_document ||= xml_presenter.document
18✔
26
  end
27

28
  def created
4✔
29
    @project.created_at.strftime("%b %e, %Y %l:%M %p")
69✔
30
  end
31

32
  def updated
4✔
33
    @project.updated_at.strftime("%b %e, %Y %l:%M %p")
69✔
34
  end
35

36
  def data_sponsor
4✔
37
    User.find_by(uid: @project.metadata["data_sponsor"]).uid
69✔
38
  end
39

40
  def data_manager
4✔
41
    User.find_by(uid: @project.metadata["data_manager"]).uid
69✔
42
  end
43

44
  # used to hide the project root that is not visible to the end user
45
  def project_directory
4✔
46
    project.project_directory.gsub(Mediaflux::Connection.hidden_root, "")
28✔
47
  end
48

49
  def storage_capacity(session_id: nil)
4✔
50
    return project_metadata.storage_capacity if session_id.nil?
73✔
51

52
    persisted = project.storage_capacity_raw(session_id: session_id)
69✔
53
    value = persisted.to_f
69✔
54

55
    value*default_capacity_divisor
69✔
56
  end
57

58
  def formatted_storage_capacity(session_id:)
4✔
59
    value = storage_capacity(session_id: session_id)
69✔
60
    format("%.3f", value)
69✔
61
  end
62

63
  def formatted_quota_percentage(session_id:)
4✔
64
    value = quota_percentage(session_id:)
69✔
65
    format("%.3f", value)
69✔
66
  end
67

68
  def quota_usage(session_id:)
4✔
69
    "#{project.storage_usage(session_id:)} out of #{project.storage_capacity(session_id:)} used"
421✔
70
  end
71

72
  def quota_percentage(session_id:)
4✔
73
    storage_capacity = project.storage_capacity_raw(session_id:)
314✔
74
    return 0 if storage_capacity.zero?
314✔
75

76
    storage_usage = project.storage_usage_raw(session_id:)
84✔
77
    (storage_usage.to_f / storage_capacity.to_f) * 100
84✔
78
  end
79

80
  private
4✔
81

82
    # Capacity is in bytes
83
    def default_capacity_divisor
4✔
84
      1.0/(1000.0**3)
69✔
85
    end
86

87
    def xml_presenter_args
4✔
88
      project
18✔
89
    end
90

91
    def xml_presenter
4✔
92
      @xml_presenter ||= self.class.xml_presenter_class.new(xml_presenter_args)
18✔
93
    end
94
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

© 2025 Coveralls, Inc