Skip to content

Commit

Permalink
Merge branch 'master' into COSBETA-80_set_up_analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
kicferk1 authored Mar 15, 2019
2 parents 2317cbb + ea06676 commit 9ab1ec0
Show file tree
Hide file tree
Showing 21 changed files with 139 additions and 134 deletions.
27 changes: 15 additions & 12 deletions cosmetics-web/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PATH
specs:
shared-web (1.0.0)
active_hash (= 2.2.1)
aws-sdk-s3 (= 1.31.0)
aws-sdk-s3 (= 1.32.0)
elasticsearch-model (= 6.0.0)
elasticsearch-rails (= 6.0.0)
govuk_notify_rails (= 2.1.0)
Expand Down Expand Up @@ -91,21 +91,23 @@ GEM
ansi (1.5.0)
arel (9.0.0)
ast (2.4.0)
aws-eventstream (1.0.1)
aws-partitions (1.143.0)
aws-sdk-core (3.46.2)
aws-eventstream (~> 1.0)
aws-eventstream (1.0.2)
aws-partitions (1.144.0)
aws-sdk-core (3.47.0)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0)
aws-sigv4 (~> 1.1)
http-2 (~> 0.10)
jmespath (~> 1.0)
aws-sdk-kms (1.13.0)
aws-sdk-core (~> 3, >= 3.39.0)
aws-sigv4 (~> 1.0)
aws-sdk-s3 (1.31.0)
aws-sdk-core (~> 3, >= 3.39.0)
aws-sdk-kms (1.14.0)
aws-sdk-core (~> 3, >= 3.47.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.32.0)
aws-sdk-core (~> 3, >= 3.47.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
aws-sigv4 (1.0.3)
aws-sigv4 (1.1.0)
aws-eventstream (~> 1.0, >= 1.0.2)
backport (0.3.0)
bootsnap (1.4.1)
msgpack (~> 1.0)
Expand Down Expand Up @@ -177,6 +179,7 @@ GEM
hashie (3.6.0)
hirb (0.7.3)
htmlentities (4.3.4)
http-2 (0.10.1)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.6.0)
Expand Down
1 change: 1 addition & 0 deletions cosmetics-web/app/analyzers/read_data_analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def create_notification_from_file
cpnp_reference: cpnp_export_info.cpnp_reference,
cpnp_is_imported: cpnp_export_info.is_imported,
cpnp_imported_country: cpnp_export_info.imported_country,
cpnp_notification_date: cpnp_export_info.cpnp_notification_date,
responsible_person: @notification_file.responsible_person)
notification.notification_file_parsed
notification.save(context: :file_upload)
Expand Down
2 changes: 1 addition & 1 deletion cosmetics-web/app/assets/packs/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import GOVUKFrontend from 'govuk-frontend';

import '../application/javascripts/bulk_file_upload_error_handling';

import '../../../vendor/shared-web/app/assets/application/javascripts/location_picker';
import 'shared-web/app/assets/application/javascripts/location_picker';

// Styles
import 'govuk-country-and-territory-autocomplete/dist/location-autocomplete.min.css';
Expand Down
5 changes: 5 additions & 0 deletions cosmetics-web/app/models/cpnp_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def cpnp_reference
@xml_doc.xpath("//cpnpReference").first&.text
end

def cpnp_notification_date
dates = @xml_doc.xpath("//modificationDate").map { |element| Time.zone.parse(element.text) }
dates.min
end

def notification_status
@xml_doc.xpath('//status').first&.text
end
Expand Down
39 changes: 22 additions & 17 deletions cosmetics-web/app/views/application/_registered_product.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,26 @@ li.product
h3.govuk-heading-m[class="govuk-!-margin-bottom-2"]
= link_to notification.product_name, notification_path, class: "product-title govuk-link--no-visited-state"
.product-data.govuk-body-s
dt
| First registered in the UK:
dd
= notification.created_at.strftime("%d/%m/%Y")
dt
| Last modified:
dd
= notification.updated_at.strftime("%d/%m/%Y")
dt
| UK cosmetic product number:
dd
= notification.reference_number_for_display
dl
.govuk-clearfix
dt
| First registered in the UK:
dd
= notification.created_at.strftime("%d/%m/%Y")
.govuk-clearfix
dt
| Last modified:
dd
= notification.updated_at.strftime("%d/%m/%Y")
.govuk-clearfix
dt
| UK cosmetic product number:
dd
= notification.reference_number_for_display

- if notification.cpnp_reference.present?
dt
| EU reference number:
dd
= notification.cpnp_reference
- if notification.cpnp_reference.present?
.govuk-clearfix
dt
| EU reference number:
dd
= notification.cpnp_reference
22 changes: 13 additions & 9 deletions cosmetics-web/app/views/application/_unfinished_product.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ li.product
edit_responsible_person_notification_path(notification.responsible_person, notification),
class: "product-title govuk-link--no-visited-state"
.product-data.govuk-body-s
dt
| UK cosmetic product number:
dd
= notification.reference_number_for_display
dl
.govuk-clearfix
dt
| UK cosmetic product number:
dd
= notification.reference_number_for_display

- if notification.cpnp_reference.present?
.govuk-clearfix
dt
| EU reference number:
dd
= notification.cpnp_reference

- if notification.cpnp_reference.present?
dt
| EU reference number:
dd
= notification.cpnp_reference
p.add-documents
- if notification.formulation_required?
= link_to "Add formulation document and product image to finish registration",
Expand Down
6 changes: 3 additions & 3 deletions cosmetics-web/app/views/layouts/_header.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ html.govuk-template.app-html-class[lang="en"]
link[rel="apple-touch-icon" sizes="167x167" href=asset_pack_path("media/images/govuk-apple-touch-icon-167x167.png")]
link[rel="apple-touch-icon" sizes="152x152" href=asset_pack_path("media/images/govuk-apple-touch-icon-152x152.png")]
link[rel="apple-touch-icon" href=asset_pack_path("media/images/govuk-apple-touch-icon.png")]
/![if !IE 8]
/![if gt IE 8]><!
= javascript_pack_tag "application"
= stylesheet_pack_tag "application"
/![endif]
/[if IE 8]
/!<![endif]
/[if lte IE 8]
= javascript_pack_tag "application-ie8"
= stylesheet_pack_tag "application-ie8"
= csrf_meta_tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ table.govuk-table
- if image.file_exists? && image.marked_as_safe?
= link_to image.filename, url_for(image.file)
br
- if notification.cpnp_notification_date.present?
tr.govuk-table__row
th.govuk-table__header
| EU notification date
td.govuk-table__cell
= notification.cpnp_notification_date.strftime("%d/%m/%Y")
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
= image_upload.filename
' failed anti-virus scan
br
- if @notification.cpnp_notification_date.present?
tr.govuk-table__row
th.govuk-table__header
| EU notification date
td.govuk-table__cell
= @notification.cpnp_notification_date.strftime("%d/%m/%Y")
.govuk-grid-column-two-thirds
h3.govuk-heading-m
| Now register your cosmetic product
Expand Down
2 changes: 1 addition & 1 deletion cosmetics-web/config/webpacker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ default: &default

# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: []
resolved_paths: ['vendor']

# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddCpnpModificationDateToNotifications < ActiveRecord::Migration[5.2]
def change
add_column :notifications, :cpnp_notification_date, :datetime
end
end
3 changes: 2 additions & 1 deletion cosmetics-web/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_03_05_143843) do
ActiveRecord::Schema.define(version: 2019_03_13_115313) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -131,6 +131,7 @@
t.boolean "cpnp_is_imported"
t.string "cpnp_imported_country"
t.string "shades"
t.datetime "cpnp_notification_date"
t.index ["cpnp_reference", "responsible_person_id"], name: "index_notifications_on_cpnp_reference_and_rp_id", unique: true
t.index ["reference_number"], name: "index_notifications_on_reference_number", unique: true
t.index ["responsible_person_id"], name: "index_notifications_on_responsible_person_id"
Expand Down
8 changes: 8 additions & 0 deletions cosmetics-web/spec/analyzers/read_data_analyzer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
expect(notification.cpnp_reference).equal?("1000094")
end

it "creates a notification populated with relevant cpnp date" do
analyzer_instance = ReadDataAnalyzer.new(notification_file_basic.uploaded_file)
analyzer_instance.metadata
notification = Notification.order(created_at: :asc).last

expect(notification.cpnp_notification_date.to_s).equal?("2012-02-08 16:02:34 UTC")
end

it "creates a notification populated with relevant shades" do
analyzer_instance = ReadDataAnalyzer.new(notification_file_shades_import.uploaded_file)
analyzer_instance.metadata
Expand Down
2 changes: 1 addition & 1 deletion keycloak/govuk-theme
2 changes: 1 addition & 1 deletion keycloak/providers/sms-authenticator
27 changes: 15 additions & 12 deletions mspsds-web/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PATH
specs:
shared-web (1.0.0)
active_hash (= 2.2.1)
aws-sdk-s3 (= 1.31.0)
aws-sdk-s3 (= 1.32.0)
elasticsearch-model (= 6.0.0)
elasticsearch-rails (= 6.0.0)
govuk_notify_rails (= 2.1.0)
Expand Down Expand Up @@ -100,21 +100,23 @@ GEM
ansi (1.5.0)
arel (9.0.0)
ast (2.4.0)
aws-eventstream (1.0.1)
aws-partitions (1.143.0)
aws-sdk-core (3.46.2)
aws-eventstream (~> 1.0)
aws-eventstream (1.0.2)
aws-partitions (1.144.0)
aws-sdk-core (3.47.0)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0)
aws-sigv4 (~> 1.1)
http-2 (~> 0.10)
jmespath (~> 1.0)
aws-sdk-kms (1.13.0)
aws-sdk-core (~> 3, >= 3.39.0)
aws-sigv4 (~> 1.0)
aws-sdk-s3 (1.31.0)
aws-sdk-core (~> 3, >= 3.39.0)
aws-sdk-kms (1.14.0)
aws-sdk-core (~> 3, >= 3.47.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.32.0)
aws-sdk-core (~> 3, >= 3.47.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
aws-sigv4 (1.0.3)
aws-sigv4 (1.1.0)
aws-eventstream (~> 1.0, >= 1.0.2)
axlsx_rails (0.5.2)
actionpack (>= 3.1)
axlsx (>= 2.0.1)
Expand Down Expand Up @@ -184,6 +186,7 @@ GEM
hashie (3.6.0)
hirb (0.7.3)
htmlentities (4.3.4)
http-2 (0.10.1)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.6.0)
Expand Down
2 changes: 1 addition & 1 deletion mspsds-web/app/assets/packs/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Rails from 'rails-ujs';
import GOVUKFrontend from 'govuk-frontend';

import '../../../vendor/shared-web/app/assets/application/javascripts/location_picker';
import 'shared-web/app/assets/application/javascripts/location_picker';

import '../application/javascripts/investigations/attachment_description';
import '../application/javascripts/investigations/ts_investigations/which_businesses';
Expand Down
Loading

0 comments on commit 9ab1ec0

Please sign in to comment.