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

pulibrary / tigerdata-app / 1e6b9da2-8324-4ed5-9062-0fb2fa61e479

19 Dec 2025 08:18PM UTC coverage: 79.461% (-8.5%) from 87.984%
1e6b9da2-8324-4ed5-9062-0fb2fa61e479

Pull #2330

circleci

kelynch
Fixed Skeletor spec tests
Pull Request #2330: Error message enhancements in the wizard

9 of 14 new or added lines in 1 file covered. (64.29%)

581 existing lines in 24 files now uncovered.

2623 of 3301 relevant lines covered (79.46%)

288.32 hits per line

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

45.74
/app/controllers/projects_controller.rb
1
# frozen_string_literal: true
2
class ProjectsController < ApplicationController
2✔
3

4
  before_action :set_breadcrumbs
2✔
5
  before_action :authenticate_user!
2✔
6

7
  def details
2✔
8
    return if project.blank?
×
9

10
    add_breadcrumb(@presenter.title, project_path)
×
11
    add_breadcrumb("Details")
×
12

13
    project_metadata = @project.metadata
×
14
    storage_capacity = project_metadata[:storage_capacity]
×
15
    size = storage_capacity[:size]
×
16
    unit = storage_capacity[:unit]
×
17

18
    @requested_size = size[:requested]
×
19
    @requested_unit = unit[:requested]
×
20

21
    @approved_size = size[:approved]
×
22
    @approved_unit = unit[:approved]
×
23

24
    @project_session = "details"
×
25

26
    respond_to do |format|
×
27
      format.html do
×
28
        render
×
29
      end
30
      format.json do
×
31
        render json: project.to_json
×
32
      end
33
      format.xml do
×
34
        render xml: @presenter.to_xml
×
35
      end
36
    end
37
  end
38

39
  def index
2✔
40
    if current_user.eligible_sysadmin?
×
41
      search_projects
×
42
    else
43
      flash[:alert] = I18n.t(:access_denied)
×
44
      redirect_to dashboard_path
×
45
    end
46
  end
47

48
  def show
2✔
UNCOV
49
    return if project.blank?
1✔
50

UNCOV
51
    add_breadcrumb(@presenter.title, project_path)
1✔
UNCOV
52
    add_breadcrumb("Contents")
1✔
53

UNCOV
54
    @latest_completed_download = current_user.user_requests.where(project_id: @project.id, state: "completed").order(:completion_time).last
1✔
UNCOV
55
    @storage_usage = project.storage_usage(session_id: current_user.mediaflux_session)
1✔
UNCOV
56
    @storage_capacity = project.storage_capacity(session_id: current_user.mediaflux_session)
1✔
57

UNCOV
58
    @num_files = project.asset_count(session_id: current_user.mediaflux_session)
1✔
59

UNCOV
60
    @file_list = project.file_list(session_id: current_user.mediaflux_session, size: 100)
1✔
UNCOV
61
    @files = @file_list[:files]
1✔
UNCOV
62
    @files.sort_by!(&:path)
1✔
63

UNCOV
64
    @project_session = "content"
1✔
UNCOV
65
    respond_to do |format|
1✔
UNCOV
66
      format.html { render }
1✔
UNCOV
67
      format.xml { render xml: ProjectShowPresenter.new(project, current_user).to_xml
2✔
68
    }
69
    end
70
  end
71

72
  # GET "projects/:id/:id-mf"
73
  #
74
  # This action is used to render the mediaflux metadata for a project.
75
  def show_mediaflux
2✔
UNCOV
76
    project_id = params[:id]
2✔
UNCOV
77
    project = Project.find(project_id)
2✔
UNCOV
78
    respond_to do |format|
1✔
UNCOV
79
      format.xml do
1✔
UNCOV
80
        render xml: project.mediaflux_meta_xml(user: current_user)
1✔
81
      end
82
    end
83
  rescue => ex
UNCOV
84
    Rails.logger.error "Error getting MediaFlux XML for project #{project_id}, user #{current_user.uid}: #{ex.message}"
1✔
UNCOV
85
    flash[:alert] = "Error fetching Mediaflux XML for this project"
1✔
UNCOV
86
    redirect_to project_path(project_id)
1✔
87
  end
88

89
  def list_contents
2✔
90
    return if project.blank?
×
91

92
    project_job_service.list_contents_job(user: current_user)
×
93

94
    json_response = {
95
      message: "File list for \"#{project.title}\" is being generated in the background. A link to the downloadable file list will be available in the \"Recent Activity\" section of your dashboard when it is available. You may safely navigate away from this page or close this tab."
×
96
    }
97
    render json: json_response
×
98
  rescue => ex
99
    message = "Error producing document list (project id: #{project&.id}): #{ex.message}"
×
100
    Rails.logger.error(message)
×
101
    Honeybadger.notify(message)
×
102
    render json: { message: "Document list could not be generated." }
×
103
  end
104

105
  def file_list_download
2✔
106
    job_id = params[:job_id]
×
107
    user_request = FileInventoryRequest.where(job_id:job_id).first
×
108
    if user_request.nil?
×
109
      # TODO: handle error
110
      redirect_to "/"
×
111
    else
112
      filename = user_request.output_file
×
113
      send_data File.read(filename), type: "text/plain", filename: "filelist.csv", disposition: "attachment"
×
114
    end
115
  end
116

117
  private
2✔
118

119
    def project_job_service
2✔
120
      @project_job_service ||= ProjectJobService.new(project:)
×
121
    end
122

123
    def project
2✔
UNCOV
124
      @project ||= begin
6✔
UNCOV
125
        project = Project.find(params[:id])
1✔
UNCOV
126
        @presenter = ProjectShowPresenter.new(project, current_user)
1✔
UNCOV
127
        if project&.mediaflux_id != nil && @presenter.user_has_access?(user: current_user)
1✔
UNCOV
128
          project
1✔
129
        else
130
          flash[:alert] = I18n.t(:access_denied)
×
131
          redirect_to dashboard_path
×
132
          nil
×
133
        end
134
      end
135
    end
136

137
    def eligible_editor?
2✔
138
      return true if current_user.eligible_sponsor? or current_user.eligible_manager?
×
139
    end
140

141
    def set_breadcrumbs
2✔
UNCOV
142
      add_breadcrumb("Dashboard",dashboard_path)
3✔
143
    end
144

145
    def search_projects
2✔
146
      @title_query = if params[:title_query].present?
×
147
        params[:title_query]
×
148
      else
149
        "*" # default to all projects
×
150
      end
151
      result =  ProjectSearch.new.call(search_string: @title_query, requestor: current_user)
×
152
      if result.success?
×
153
        flash[:notice] = "Successful search in Mediaflux for #{@title_query}"
×
154
        @project_presenters = result.value!
×
155
      else
156
        flash[:notice] = "Error searching projects for #{@title_query}.  Error: #{result.failure}"
×
157
        @project_presenters = []
×
158
      end
159
    end
160
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