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

pulibrary / tigerdata-app / 5205f704-d89d-4c43-8cfa-9e6783edc33a

29 Feb 2024 07:04PM UTC coverage: 60.206% (-29.9%) from 90.092%
5205f704-d89d-4c43-8cfa-9e6783edc33a

push

circleci

jrgriffiniii
Ensuring that the storage usage and storage capacity is retrieved for
Mediaflux Projects and rendered on the "contents" Project View

11 of 34 new or added lines in 4 files covered. (32.35%)

451 existing lines in 34 files now uncovered.

935 of 1553 relevant lines covered (60.21%)

9.47 hits per line

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

68.0
/app/jobs/list_project_contents_job.rb
1
# frozen_string_literal: true
2
class ListProjectContentsJob < ApplicationJob
1✔
3
  def perform(user_id:, project_id:)
1✔
4
    project = Project.find(project_id)
3✔
5
    raise "Invalid project id #{project_id} for job #{job_id}" if project.nil?
3✔
6
    user = User.find(user_id)
3✔
7
    raise "Invalid user id #{user_id} for job #{job_id}" if user.nil?
2✔
8

9
    # Queries Mediaflux for the file list and saves it to a CSV file.
10
    filename = filename_for_export
2✔
11
    Rails.logger.info "Exporting file list to #{filename} for project #{project_id}"
2✔
12
    project.file_list_to_file(session_id: mediaflux_session, filename: filename)
2✔
UNCOV
13
    Rails.logger.info "Export file generated #{filename} for project #{project_id}"
×
14

UNCOV
15
    mark_user_job_as_complete(project: project, user: user)
×
16
  end
17

18
  private
1✔
19

20
    def mediaflux_session
1✔
21
      logon_request = Mediaflux::Http::LogonRequest.new
2✔
UNCOV
22
      logon_request.resolve
×
UNCOV
23
      logon_request.session_token
×
24
    end
25

26
    def filename_for_export
1✔
27
      raise "Shared location is not configured" if Rails.configuration.mediaflux["shared_files_location"].blank?
2✔
28
      pathname = Pathname.new(Rails.configuration.mediaflux["shared_files_location"])
2✔
29
      pathname.join("#{job_id}.csv").to_s
2✔
30
    end
31

32
    def mark_user_job_as_complete(project:, user:)
1✔
UNCOV
33
      user_job = UserJob.create_and_link_to_user(job_id: job_id, user: user, job_title: "File list for #{project.title}")
×
UNCOV
34
      user_job.completed_at = Time.current.in_time_zone("America/New_York").iso8601
×
UNCOV
35
      user_job.save!
×
UNCOV
36
      user_job.reload
×
37
    end
38
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