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

pulibrary / pdc_describe / 4e4e59fc-9df4-4838-9fd4-6c7ea33cdb7c

07 Apr 2025 06:36PM UTC coverage: 1.283% (-94.6%) from 95.862%
4e4e59fc-9df4-4838-9fd4-6c7ea33cdb7c

Pull #1994

circleci

hectorcorrea
Switched to use the autocomplete that we aleady use for ROR. Integrated it with the existing logic for creators
Pull Request #1994: Started adding auto complete to contributors

0 of 46 new or added lines in 2 files covered. (0.0%)

4806 existing lines in 74 files now uncovered.

65 of 5065 relevant lines covered (1.28%)

0.01 hits per line

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

0.0
/app/services/work_metadata_service.rb
1
# frozen_string_literal: true
2

3
# A place to move the logic to from the work controllers
4
#   Process the parameters and permissions to update a work
UNCOV
5
class WorkMetadataService
×
UNCOV
6
  attr_reader :params, :current_user
×
7

8
  # @params [User] current_user the user who is currently logged in
9
  # @param [HashWithIndifferentAccess] update_params values to update the work with
UNCOV
10
  def initialize(params:, current_user:)
×
UNCOV
11
    @params = params
×
UNCOV
12
    @current_user = current_user
×
UNCOV
13
  end
×
14

15
  # creates or finds the work for the new submission form based on the parameters
16
  #
17
  # @returns the new or updated work
UNCOV
18
  def work_for_new_submission
×
UNCOV
19
    if params[:id].present?
×
UNCOV
20
      Work.find(params[:id])
×
UNCOV
21
    else
×
22
      Work.new(created_by_user_id: current_user.id, group_id: group_code.id)
×
UNCOV
23
    end
×
UNCOV
24
  end
×
25

26
  # generates the work for a new submission
27
  #
28
  # @returns the new work
UNCOV
29
  def new_submission
×
UNCOV
30
    work = work_for_new_submission
×
UNCOV
31
    work.resource = FormToResourceService.convert(params, work)
×
UNCOV
32
    if work.valid_to_draft
×
UNCOV
33
      work.draft!(current_user)
×
UNCOV
34
    end
×
UNCOV
35
    work
×
UNCOV
36
  end
×
37

UNCOV
38
  def self.file_location_url(work)
×
UNCOV
39
    if work.files_location == "file_upload"
×
UNCOV
40
      Rails.application.routes.url_helpers.work_file_upload_path(work)
×
UNCOV
41
    else
×
UNCOV
42
      Rails.application.routes.url_helpers.work_file_other_path(work)
×
UNCOV
43
    end
×
UNCOV
44
  end
×
45

UNCOV
46
private
×
47

UNCOV
48
  def group_code
×
49
    @group_code ||= Group.find_by(code: params[:group_code]) || current_user.default_group
×
UNCOV
50
  end
×
UNCOV
51
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