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

benwbrum / fromthepage / 17387282326

01 Sep 2025 09:13PM UTC coverage: 64.405%. Remained the same
17387282326

push

github

web-flow
4857 - Require rubocop step in CI (#4858)

* 4857 - Require rubocop step in CI

* 4865 - Organize gemfiles

1790 of 3303 branches covered (54.19%)

Branch coverage included in aggregate %.

839 of 1497 new or added lines in 133 files covered. (56.05%)

43 existing lines in 29 files now uncovered.

7928 of 11786 relevant lines covered (67.27%)

103.82 hits per line

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

40.45
/app/controllers/bulk_export_controller.rb
1
class BulkExportController < ApplicationController
1✔
2
  before_action :set_bulk_export, only: [ :show, :edit, :download ]
1✔
3

4
  PAGES_PER_SCREEN = 20
1✔
5

6
  def index
1✔
7
    @bulk_exports = BulkExport.all.order('id DESC').paginate page: params[:page], per_page: PAGES_PER_SCREEN
1✔
8
  end
9

10
  def show
1✔
11
  end
12

13
  def new
1✔
14
    @bulk_export = BulkExport.new
1✔
15
    if @collection.is_a? DocumentSet
1!
16
      @bulk_export.document_set = @collection
×
17
      @bulk_export.collection = @collection.collection
×
18
    else
1✔
19
      @bulk_export.collection = @collection
1✔
20
    end
21
    @uploaded_filename_available = @collection.works.where.not(uploaded_filename: nil).exists?
1✔
22
  end
23

24
  def create
1✔
25
    @bulk_export = BulkExport.new(bulk_export_params)
1✔
26
    if @collection.is_a? DocumentSet
1!
27
      @bulk_export.document_set = @collection
×
28
      @bulk_export.collection = @collection.collection
×
29
    else
1✔
30
      @bulk_export.collection = @collection
1✔
31
    end
32
    @bulk_export.work = @work if params[:work_id]
1!
33
    @bulk_export.user = current_user
1✔
34
    @bulk_export.status = BulkExport::Status::NEW
1✔
35
    @bulk_export.report_arguments = bulk_export_params[:report_arguments].to_h
1✔
36

37
    if @bulk_export.save!
1!
38
      @bulk_export.submit_export_process
1✔
39

40
      flash[:info] = t('.export_running_message', email: (current_user.email))
1✔
41
    end
42
    redirect_to dashboard_exports_path
1✔
43
  end
44

45
  def create_for_work
1✔
46
    # i18n-tasks isn't smart enough to follow the method call here so we need to do this to get tests to pass
47
    throwaway = t('.export_running_message', email: (current_user.email))
×
48
    create_for_work_actual
×
49
    redirect_to dashboard_exports_path
×
50
  end
51

52

53
  def create_for_work_ajax
1✔
54
    create_for_work_actual
×
55
    ajax_redirect_to dashboard_exports_path
×
56
  end
57

58
  def create_for_owner
1✔
59
    @bulk_export = BulkExport.new(bulk_export_params)
×
60
    @bulk_export.user = current_user
×
61
    @bulk_export.status = BulkExport::Status::NEW
×
62
    if bulk_export_params[:report_arguments]
×
63
      @bulk_export.report_arguments = bulk_export_params[:report_arguments].to_h
×
64
    end
65

66
    if @bulk_export.save
×
67
      @bulk_export.submit_export_process
×
68

69
      flash[:info] = t('.export_running_message', email: (current_user.email))
×
70
    end
71
    redirect_to dashboard_exports_path
×
72
  end
73

74
  def download
1✔
75
    if @bulk_export.status == BulkExport::Status::FINISHED
×
76
      # read and spew the file
×
77
      send_file(@bulk_export.zip_file_name,
×
78
        filename: 'fromthepage_export.zip',
79
        content_type: 'application/zip')
UNCOV
80
      cookies['download_finished'] = 'true'
×
81
    else
×
82
      flash[:info] = t('.download_cleaned_message')
×
83
      redirect_to collection_export_path(@bulk_export.collection.owner, @bulk_export.collection)
×
84
    end
85
  end
86

87
  private
1✔
88

89
  # Use callbacks to share common setup or constraints between actions.
90
  def set_bulk_export
1✔
91
    @bulk_export = BulkExport.find(params[:bulk_export_id])
×
92
  end
93

94
  # Only allow a trusted parameter "white list" through.
95
  def bulk_export_params
1✔
96
    params.require(:bulk_export).permit(
2✔
97
      :user_id,
98
      :collection_id,
99
      :plaintext_verbatim_page,
100
      :plaintext_verbatim_work,
101
      :plaintext_emended_page,
102
      :plaintext_emended_work,
103
      :plaintext_searchable_page,
104
      :plaintext_searchable_work,
105
      :plaintext_verbatim_zero_index_page,
106
      :tei_work,
107
      :html_page,
108
      :html_work,
109
      :subject_csv_collection,
110
      :subject_details_csv_collection,
111
      :table_csv_work,
112
      :table_csv_collection,
113
      :work_metadata_csv,
114
      :facing_edition_work,
115
      :text_docx_work,
116
      :text_pdf_work,
117
      :text_only_pdf_work,
118
      :organization,
119
      :use_uploaded_filename,
120
      :static,
121
      :owner_mailing_list,
122
      :owner_detailed_activity,
123
      :collection_activity,
124
      :collection_contributors,
125
      :preserve_linebreaks,
126
      :work_id,
127
      :include_metadata,
128
      :include_contributors,
129
      :include_notes,
130
      :notes_csv,
131
      :admin_searches,
132
      report_arguments: [
133
        :start_date,
134
        :end_date,
135
        :preserve_linebreaks,
136
        :include_metadata,
137
        :include_contributors,
138
        :include_notes
139
      ]
140
    )
141
  end
142

143
  def create_for_work_actual
1✔
144
    @bulk_export = BulkExport.new(bulk_export_params)
×
145
    if @collection.is_a? DocumentSet
×
146
      @bulk_export.document_set = @collection
×
147
      @bulk_export.collection = @collection.collection
×
148
    else
×
149
      @bulk_export.collection = @collection
×
150
    end
151
    @bulk_export.work = @work
×
152
    @bulk_export.user = current_user
×
153
    @bulk_export.status = BulkExport::Status::NEW
×
154
    if bulk_export_params[:report_arguments]
×
155
      @bulk_export.report_arguments = bulk_export_params[:report_arguments].to_h
×
156
    end
157

158
    if @bulk_export.save
×
159
      @bulk_export.submit_export_process
×
160

161
      flash[:info] = t('.export_running_message', email: (current_user.email))
×
162
    end
163
  end
164
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