Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ GEM
aes_key_wrap (1.1.0)
ast (2.4.2)
aws-eventstream (1.3.0)
aws-partitions (1.1041.0)
aws-partitions (1.1043.0)
aws-record (2.13.2)
aws-sdk-dynamodb (~> 1, >= 1.85.0)
aws-sdk-core (3.216.0)
aws-sdk-core (3.217.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
Expand Down Expand Up @@ -171,7 +171,7 @@ GEM
bindex (0.8.1)
bootsnap (1.18.4)
msgpack (~> 1.2)
brakeman (6.2.2)
brakeman (7.0.0)
racc
builder (3.3.0)
bullet (8.0.0)
Expand Down Expand Up @@ -225,7 +225,7 @@ GEM
docile (1.4.1)
dotenv (3.1.7)
drb (2.2.1)
dumb_delegator (1.0.0)
dumb_delegator (1.1.0)
erubi (1.13.1)
excon (1.2.3)
factory_bot (6.5.0)
Expand Down Expand Up @@ -319,7 +319,7 @@ GEM
kaminari-core (1.2.2)
kramdown (2.5.1)
rexml (>= 3.3.9)
language_server-protocol (3.17.0.3)
language_server-protocol (3.17.0.4)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand Down Expand Up @@ -421,7 +421,7 @@ GEM
date
stringio
public_suffix (6.0.1)
puma (6.5.0)
puma (6.6.0)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.1.8)
Expand Down Expand Up @@ -520,7 +520,7 @@ GEM
rspec-support (3.13.2)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.70.0)
rubocop (1.71.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -530,9 +530,9 @@ GEM
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
rubocop-ast (1.38.0)
parser (>= 3.3.1.0)
rubocop-rails (2.29.0)
rubocop-rails (2.29.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
Expand Down
66 changes: 35 additions & 31 deletions app/controllers/admin/cx_collection_details_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,41 +74,44 @@ def export_csv
# Handle a large-ish csv upload (5+ MB) to S3
def upload_csv
file = params[:file] # Assuming the file comes from a form field named 'file'

file_extension = File.extname(file.original_filename).downcase

@valid_file_extension = (file_extension == ".csv")

# check the file to ensure it is valid
csv_file = CSV.parse(file.read, headers: true)
begin
@valid_file_headers = csv_file.headers.sort == [
"external_id",
"question_1",
"positive_effectiveness",
"positive_ease",
"positive_efficiency",
"positive_transparency",
"positive_humanity",
"positive_employee",
"positive_other",
"negative_effectiveness",
"negative_ease",
"negative_efficiency",
"negative_transparency",
"negative_humanity",
"negative_employee",
"negative_other",
"question_4"
].sort
rescue CSV::MalformedCSVError => e
flash[:alert] = "There was an error processing the CSV file: #{e.message}"
@valid_file_headers = false
rescue
@valid_file_headers = false
@valid_file_encoding = false
file_contents = file.read.encode("UTF-8", invalid: :replace, undef: :replace, replace: "")
@valid_file_encoding = file_contents.encoding.name == "UTF-8" && file_contents.valid_encoding?

if @valid_file_encoding
csv_file = CSV.parse(file_contents, headers: true)
begin
@valid_file_headers = csv_file.headers.sort == [
"external_id",
"question_1",
"positive_effectiveness",
"positive_ease",
"positive_efficiency",
"positive_transparency",
"positive_humanity",
"positive_employee",
"positive_other",
"negative_effectiveness",
"negative_ease",
"negative_efficiency",
"negative_transparency",
"negative_humanity",
"negative_employee",
"negative_other",
"question_4"
].sort
rescue CSV::MalformedCSVError => e
flash[:alert] = "There was an error processing the CSV file: #{e.message}"
@valid_file_headers = false
rescue
@valid_file_headers = false
end
end

if @valid_file_extension && @valid_file_headers
if @valid_file_encoding && @valid_file_extension && @valid_file_headers
key = "cx_data_collections/cx-upload-#{timestamp_string}-#{file.original_filename}"
obj = s3_bucket.object(key)
# Upload the file
Expand All @@ -124,13 +127,14 @@ def upload_csv
Event.log_event(Event.names[:cx_collection_detail_upload_created], @cxdu.class.to_s, @cxdu.id, "CX Collection Detail Upload #{@cxdu.id} created at #{DateTime.now}", current_user.id)

flash[:notice] = "A .csv file with #{csv_file.size} rows was uploaded successfully. Please see your uploaded file in the table below, then return to the CX Data Collection."
elsif !@valid_file_encoding
flash[:alert] = "The uploaded file must be encoded as UTF-8"
elsif !@valid_file_extension
flash[:notice] = "File has a file extension of #{file_extension}, but it should be .csv."
elsif !@valid_file_headers
flash[:alert] = "CSV headers do not match. Headers received were: #{csv_file.headers.to_s}"
end

# render :upload
redirect_to upload_admin_cx_collection_detail_path(@cx_collection_detail)
end

Expand Down
5 changes: 3 additions & 2 deletions app/controllers/admin/forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ def show
end

def export
start_date = params[:start_date] ? Date.parse(params[:start_date]).to_date : Time.zone.now.beginning_of_quarter
end_date = params[:end_date] ? Date.parse(params[:end_date]).to_date : Time.zone.now.end_of_quarter
start_date = params[:start_date] ? Date.parse(params[:start_date]).to_date.beginning_of_day : Time.zone.now.beginning_of_quarter
end_date = params[:end_date] ? Date.parse(params[:end_date]).to_date.end_of_day : Time.zone.now.end_of_quarter

count = Form.find_by_short_uuid(@form.short_uuid).non_flagged_submissions(start_date:, end_date:).count
if count > MAX_ROWS_TO_EXPORT
Expand Down Expand Up @@ -593,6 +593,7 @@ def form_admin_options_params
:service_id,
:service_stage_id,
:enforce_new_submission_validations,
:legacy_link_feature_flag,
)
end

Expand Down
76 changes: 0 additions & 76 deletions app/controllers/admin/offerings_controller.rb

This file was deleted.

6 changes: 0 additions & 6 deletions app/helpers/admin/offerings_helper.rb

This file was deleted.

1 change: 1 addition & 0 deletions app/models/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def duplicate!(new_user:)
new_form.organization = new_user.organization
new_form.template = false
new_form.enforce_new_submission_validations = true
new_form.legacy_link_feature_flag = false
new_form.save!

# Manually remove the Form Section created with create_first_form_section
Expand Down
13 changes: 0 additions & 13 deletions app/models/offering.rb

This file was deleted.

9 changes: 9 additions & 0 deletions app/views/admin/forms/_admin_options.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@
<% end %>
</div>
</fieldset>
<fieldset class="usa-fieldset">
<legend class="usa-sr-only">legacy_link_feature_flag</legend>
<div class="usa-checkbox">
<%= f.check_box :legacy_link_feature_flag, class: "usa-checkbox__input" %>
<%= f.label :legacy_link_feature_flag, class: "usa-checkbox__label" do %>
legacy_link_feature_flag
<% end %>
</div>
</fieldset>
</div>
</div>
<p class="margin-top-4">
Expand Down
36 changes: 0 additions & 36 deletions app/views/admin/offerings/_form.html.erb

This file was deleted.

60 changes: 0 additions & 60 deletions app/views/admin/offerings/_offering_personas.html.erb

This file was deleted.

Loading