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

pulibrary / tigerdata-app / 529f7cba-0651-41c2-9045-ff17f0a5a349

21 Oct 2025 09:43PM UTC coverage: 86.877%. Remained the same
529f7cba-0651-41c2-9045-ff17f0a5a349

Pull #2070

circleci

bess
Remove tests for special production behavior
Pull Request #2070: Remove tests for special behavior in production

2615 of 3010 relevant lines covered (86.88%)

340.18 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
3✔
3
  delegate "id", "in_mediaflux?", "mediaflux_id", "status", "title", to: :project
3✔
4
  delegate "description", "project_id", "storage_performance_expectations", "project_purpose", to: :project_metadata
3✔
5

6
  attr_reader :project, :project_metadata
3✔
7

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

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

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

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

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

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

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

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

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

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

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

55
    value*default_capacity_divisor
34✔
56
  end
57

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

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

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

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

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

80
  private
3✔
81

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

87
    def xml_presenter_args
3✔
88
      project
8✔
89
    end
90

91
    def xml_presenter
3✔
92
      @xml_presenter ||= self.class.xml_presenter_class.new(xml_presenter_args)
8✔
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