From 01e5fbbac657b70267da279c72289c0dd65f0118 Mon Sep 17 00:00:00 2001 From: Sarala Wimalaratne Date: Mon, 3 Feb 2020 10:30:01 +0000 Subject: [PATCH 1/6] added seeds.rb for data --- .gitignore | 3 +++ db/schema.rb | 36 ++++++++++++------------------------ 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 48d9a501f..8f99c9ce2 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ /db/*.sqlite3 /db/*.sqlite3-journal +# Ignore seed datafile +/db/seeds.rb + # Ignore all logfiles and tempfiles. /log/* /tmp/* diff --git a/db/schema.rb b/db/schema.rb index 5b195b293..b727c3baa 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ ActiveRecord::Schema.define(version: 2020_01_22_153731) do - create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin", force: :cascade do |t| + create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| t.string "name", limit: 191, null: false t.string "record_type", null: false t.bigint "record_id", null: false @@ -22,7 +22,7 @@ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end - create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin", force: :cascade do |t| + create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| t.string "key", limit: 191, null: false t.string "filename", limit: 191, null: false t.string "content_type", limit: 191 @@ -33,7 +33,7 @@ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end - create_table "allocator", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| + create_table "allocator", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "system_email", null: false t.datetime "created" t.integer "doi_quota_allowed", null: false @@ -77,7 +77,7 @@ t.index ["symbol"], name: "symbol", unique: true end - create_table "allocator_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| + create_table "allocator_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.bigint "allocator", null: false t.bigint "prefixes", null: false t.datetime "created_at" @@ -87,7 +87,7 @@ t.index ["prefixes"], name: "FKE7FBD674AF86A1C7" end - create_table "audits", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin", force: :cascade do |t| + create_table "audits", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| t.integer "auditable_id" t.string "auditable_type" t.integer "associated_id" @@ -109,18 +109,7 @@ t.index ["user_id", "user_type"], name: "user_index" end - create_table "contacts", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| - t.bigint "allocator" - t.string "email" - t.string "given_name" - t.string "family_name" - t.string "role" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["allocator"], name: "fk_rails_5c598567a8" - end - - create_table "datacentre", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| + create_table "datacentre", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.text "comments", limit: 4294967295 t.string "system_email", null: false t.datetime "created" @@ -158,7 +147,7 @@ t.index ["url"], name: "index_datacentre_on_url", length: 100 end - create_table "datacentre_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| + create_table "datacentre_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.bigint "datacentre", null: false t.bigint "prefixes", null: false t.datetime "created_at" @@ -170,7 +159,7 @@ t.index ["prefixes"], name: "FK13A1B3BAAF86A1C7" end - create_table "dataset", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| + create_table "dataset", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.datetime "created" t.string "doi", null: false t.binary "is_active", limit: 1, null: false @@ -247,14 +236,14 @@ t.string "license", limit: 191 t.text "doi_id" t.index ["created_at", "indexed_at", "updated_at"], name: "index_events_on_created_indexed_updated" - t.index ["relation_type_id"], name: "index_events_on_doi_id" + t.index ["doi_id", "relation_type_id"], name: "index_events_on_doi_id", length: { doi_id: 100 } t.index ["source_id", "created_at"], name: "index_events_on_source_id_created_at" t.index ["subj_id", "obj_id", "source_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 } t.index ["updated_at"], name: "index_events_on_updated_at" t.index ["uuid"], name: "index_events_on_uuid", unique: true, length: 36 end - create_table "media", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| + create_table "media", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.datetime "created" t.string "media_type", limit: 80 t.datetime "updated" @@ -266,7 +255,7 @@ t.index ["url"], name: "index_media_on_url", length: 100 end - create_table "metadata", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| + create_table "metadata", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.datetime "created" t.integer "metadata_version" t.integer "version" @@ -278,7 +267,7 @@ t.index ["dataset"], name: "FKE52D7B2F4D3D6B1B" end - create_table "prefix", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| + create_table "prefix", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.datetime "created" t.string "prefix", limit: 80, null: false t.integer "version" @@ -317,7 +306,6 @@ add_foreign_key "allocator_prefixes", "allocator", column: "allocator", name: "FKE7FBD67446EBD781" add_foreign_key "allocator_prefixes", "prefix", column: "prefixes", name: "FKE7FBD674AF86A1C7" - add_foreign_key "contacts", "allocator", column: "allocator" add_foreign_key "datacentre", "allocator", column: "allocator", name: "FK6695D60546EBD781" add_foreign_key "datacentre_prefixes", "datacentre", column: "datacentre", name: "FK13A1B3BA47B5F5FF" add_foreign_key "datacentre_prefixes", "prefix", column: "prefixes", name: "FK13A1B3BAAF86A1C7" From 7aa146f69215cfbb994590d4e488efd41453a533 Mon Sep 17 00:00:00 2001 From: Sarala Wimalaratne Date: Tue, 4 Feb 2020 16:05:25 +0000 Subject: [PATCH 2/6] checking whether the username is present --- app/serializers/activity_serializer.rb | 4 ++- db/schema.rb | 35 +++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/app/serializers/activity_serializer.rb b/app/serializers/activity_serializer.rb index 9892fd70d..f8e3824b1 100644 --- a/app/serializers/activity_serializer.rb +++ b/app/serializers/activity_serializer.rb @@ -15,7 +15,9 @@ class ActivitySerializer attribute "prov:wasAttributedTo" do |object| url = Rails.env.production? ? "https://api.datacite.org" : "https://api.test.datacite.org" - object.username.include?(".") ? url + "/clients/" + object.username : url + "/providers/" + object.username + if object.username.present? + object.username.to_s.include?(".") ? url + "/clients/" + object.username : url + "/providers/" + object.username + end end attribute "prov:wasGeneratedBy" do |object| diff --git a/db/schema.rb b/db/schema.rb index 3f8371965..1895360e9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -240,15 +240,44 @@ t.string "source_relation_type_id", limit: 191 t.string "target_relation_type_id", limit: 191 t.index ["created_at", "indexed_at", "updated_at"], name: "index_events_on_created_indexed_updated" - t.index ["created_at"], name: "index_events_on_source_id_created_at" - t.index ["relation_type_id"], name: "index_events_on_doi_id" + t.index ["doi_id", "relation_type_id"], name: "index_events_on_doi_id", length: { doi_id: 100 } t.index ["source_doi", "source_relation_type_id"], name: "index_events_on_source_doi", length: { source_doi: 100 } - t.index ["subj_id", "obj_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 } + t.index ["source_id", "created_at"], name: "index_events_on_source_id_created_at" + t.index ["subj_id", "obj_id", "source_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 } t.index ["target_doi", "target_relation_type_id"], name: "index_events_on_target_doi", length: { target_doi: 100 } t.index ["updated_at"], name: "index_events_on_updated_at" t.index ["uuid"], name: "index_events_on_uuid", unique: true, length: 36 end + create_table "lhma_2020_02_03_11_33_29_151_events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.text "uuid", null: false + t.text "subj_id", null: false + t.text "obj_id" + t.string "source_id", limit: 191 + t.string "aasm_state" + t.string "state_event" + t.text "callback" + t.text "error_messages" + t.text "source_token" + t.datetime "created_at", precision: 3, null: false + t.datetime "updated_at", precision: 3, null: false + t.datetime "indexed_at", default: "1970-01-01 00:00:00", null: false + t.datetime "occurred_at" + t.string "message_action", limit: 191, default: "create", null: false + t.string "relation_type_id", limit: 191 + t.text "subj", limit: 16777215 + t.text "obj", limit: 16777215 + t.integer "total", default: 1 + t.string "license", limit: 191 + t.text "doi_id" + t.index ["created_at", "indexed_at", "updated_at"], name: "index_events_on_created_indexed_updated" + t.index ["doi_id", "relation_type_id"], name: "index_events_on_doi_id", length: { doi_id: 100 } + t.index ["source_id", "created_at"], name: "index_events_on_source_id_created_at" + t.index ["subj_id", "obj_id", "source_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 } + t.index ["updated_at"], name: "index_events_on_updated_at" + t.index ["uuid"], name: "index_events_on_uuid", unique: true, length: 36 + end + create_table "media", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.datetime "created" t.string "media_type", limit: 80 From 28d5f3799feb3dad36eaa53a0bbcd486414d5f19 Mon Sep 17 00:00:00 2001 From: Sarala Wimalaratne Date: Wed, 5 Feb 2020 08:50:12 +0000 Subject: [PATCH 3/6] Revert "added seeds.rb for data" This reverts commit 01e5fbbac657b70267da279c72289c0dd65f0118. --- .gitignore | 3 --- db/schema.rb | 36 ++++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 8f99c9ce2..48d9a501f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,6 @@ /db/*.sqlite3 /db/*.sqlite3-journal -# Ignore seed datafile -/db/seeds.rb - # Ignore all logfiles and tempfiles. /log/* /tmp/* diff --git a/db/schema.rb b/db/schema.rb index 1895360e9..509c3a96b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ ActiveRecord::Schema.define(version: 2020_01_31_180609) do - create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin", force: :cascade do |t| t.string "name", limit: 191, null: false t.string "record_type", null: false t.bigint "record_id", null: false @@ -22,7 +22,7 @@ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end - create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin", force: :cascade do |t| t.string "key", limit: 191, null: false t.string "filename", limit: 191, null: false t.string "content_type", limit: 191 @@ -33,7 +33,7 @@ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end - create_table "allocator", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "allocator", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| t.string "system_email", null: false t.datetime "created" t.integer "doi_quota_allowed", null: false @@ -77,7 +77,7 @@ t.index ["symbol"], name: "symbol", unique: true end - create_table "allocator_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "allocator_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| t.bigint "allocator", null: false t.bigint "prefixes", null: false t.datetime "created_at" @@ -87,7 +87,7 @@ t.index ["prefixes"], name: "FKE7FBD674AF86A1C7" end - create_table "audits", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "audits", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin", force: :cascade do |t| t.integer "auditable_id" t.string "auditable_type" t.integer "associated_id" @@ -109,7 +109,18 @@ t.index ["user_id", "user_type"], name: "user_index" end - create_table "datacentre", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "contacts", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.bigint "allocator" + t.string "email" + t.string "given_name" + t.string "family_name" + t.string "role" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["allocator"], name: "fk_rails_5c598567a8" + end + + create_table "datacentre", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| t.text "comments", limit: 4294967295 t.string "system_email", null: false t.datetime "created" @@ -147,7 +158,7 @@ t.index ["url"], name: "index_datacentre_on_url", length: 100 end - create_table "datacentre_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "datacentre_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| t.bigint "datacentre", null: false t.bigint "prefixes", null: false t.datetime "created_at" @@ -159,7 +170,7 @@ t.index ["prefixes"], name: "FK13A1B3BAAF86A1C7" end - create_table "dataset", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "dataset", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| t.datetime "created" t.string "doi", null: false t.binary "is_active", limit: 1, null: false @@ -271,14 +282,14 @@ t.string "license", limit: 191 t.text "doi_id" t.index ["created_at", "indexed_at", "updated_at"], name: "index_events_on_created_indexed_updated" - t.index ["doi_id", "relation_type_id"], name: "index_events_on_doi_id", length: { doi_id: 100 } + t.index ["relation_type_id"], name: "index_events_on_doi_id" t.index ["source_id", "created_at"], name: "index_events_on_source_id_created_at" t.index ["subj_id", "obj_id", "source_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 } t.index ["updated_at"], name: "index_events_on_updated_at" t.index ["uuid"], name: "index_events_on_uuid", unique: true, length: 36 end - create_table "media", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "media", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| t.datetime "created" t.string "media_type", limit: 80 t.datetime "updated" @@ -290,7 +301,7 @@ t.index ["url"], name: "index_media_on_url", length: 100 end - create_table "metadata", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "metadata", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| t.datetime "created" t.integer "metadata_version" t.integer "version" @@ -302,7 +313,7 @@ t.index ["dataset"], name: "FKE52D7B2F4D3D6B1B" end - create_table "prefix", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "prefix", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| t.datetime "created" t.string "prefix", limit: 80, null: false t.integer "version" @@ -341,6 +352,7 @@ add_foreign_key "allocator_prefixes", "allocator", column: "allocator", name: "FKE7FBD67446EBD781" add_foreign_key "allocator_prefixes", "prefix", column: "prefixes", name: "FKE7FBD674AF86A1C7" + add_foreign_key "contacts", "allocator", column: "allocator" add_foreign_key "datacentre", "allocator", column: "allocator", name: "FK6695D60546EBD781" add_foreign_key "datacentre_prefixes", "datacentre", column: "datacentre", name: "FK13A1B3BA47B5F5FF" add_foreign_key "datacentre_prefixes", "prefix", column: "prefixes", name: "FK13A1B3BAAF86A1C7" From c663784aec350484d99b22d541e676d8253816a8 Mon Sep 17 00:00:00 2001 From: Sarala Wimalaratne Date: Wed, 5 Feb 2020 09:03:02 +0000 Subject: [PATCH 4/6] reverted schema.db --- app/serializers/activity_serializer.rb | 4 +-- db/schema.rb | 37 +++----------------------- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/app/serializers/activity_serializer.rb b/app/serializers/activity_serializer.rb index f8e3824b1..9892fd70d 100644 --- a/app/serializers/activity_serializer.rb +++ b/app/serializers/activity_serializer.rb @@ -15,9 +15,7 @@ class ActivitySerializer attribute "prov:wasAttributedTo" do |object| url = Rails.env.production? ? "https://api.datacite.org" : "https://api.test.datacite.org" - if object.username.present? - object.username.to_s.include?(".") ? url + "/clients/" + object.username : url + "/providers/" + object.username - end + object.username.include?(".") ? url + "/clients/" + object.username : url + "/providers/" + object.username end attribute "prov:wasGeneratedBy" do |object| diff --git a/db/schema.rb b/db/schema.rb index 509c3a96b..bc2bdaf4c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -251,44 +251,15 @@ t.string "source_relation_type_id", limit: 191 t.string "target_relation_type_id", limit: 191 t.index ["created_at", "indexed_at", "updated_at"], name: "index_events_on_created_indexed_updated" - t.index ["doi_id", "relation_type_id"], name: "index_events_on_doi_id", length: { doi_id: 100 } + t.index ["created_at"], name: "index_events_on_source_id_created_at" + t.index ["relation_type_id"], name: "index_events_on_doi_id" t.index ["source_doi", "source_relation_type_id"], name: "index_events_on_source_doi", length: { source_doi: 100 } - t.index ["source_id", "created_at"], name: "index_events_on_source_id_created_at" - t.index ["subj_id", "obj_id", "source_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 } + t.index ["subj_id", "obj_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 } t.index ["target_doi", "target_relation_type_id"], name: "index_events_on_target_doi", length: { target_doi: 100 } t.index ["updated_at"], name: "index_events_on_updated_at" t.index ["uuid"], name: "index_events_on_uuid", unique: true, length: 36 end - create_table "lhma_2020_02_03_11_33_29_151_events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| - t.text "uuid", null: false - t.text "subj_id", null: false - t.text "obj_id" - t.string "source_id", limit: 191 - t.string "aasm_state" - t.string "state_event" - t.text "callback" - t.text "error_messages" - t.text "source_token" - t.datetime "created_at", precision: 3, null: false - t.datetime "updated_at", precision: 3, null: false - t.datetime "indexed_at", default: "1970-01-01 00:00:00", null: false - t.datetime "occurred_at" - t.string "message_action", limit: 191, default: "create", null: false - t.string "relation_type_id", limit: 191 - t.text "subj", limit: 16777215 - t.text "obj", limit: 16777215 - t.integer "total", default: 1 - t.string "license", limit: 191 - t.text "doi_id" - t.index ["created_at", "indexed_at", "updated_at"], name: "index_events_on_created_indexed_updated" - t.index ["relation_type_id"], name: "index_events_on_doi_id" - t.index ["source_id", "created_at"], name: "index_events_on_source_id_created_at" - t.index ["subj_id", "obj_id", "source_id", "relation_type_id"], name: "index_events_on_multiple_columns", unique: true, length: { subj_id: 191, obj_id: 191 } - t.index ["updated_at"], name: "index_events_on_updated_at" - t.index ["uuid"], name: "index_events_on_uuid", unique: true, length: 36 - end - create_table "media", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", force: :cascade do |t| t.datetime "created" t.string "media_type", limit: 80 @@ -359,4 +330,4 @@ add_foreign_key "dataset", "datacentre", column: "datacentre", name: "FK5605B47847B5F5FF" add_foreign_key "media", "dataset", column: "dataset", name: "FK62F6FE44D3D6B1B" add_foreign_key "metadata", "dataset", column: "dataset", name: "FKE52D7B2F4D3D6B1B" -end +end \ No newline at end of file From 49f558c935921df76b8107dc78e6899158785f74 Mon Sep 17 00:00:00 2001 From: Sarala Wimalaratne Date: Wed, 5 Feb 2020 10:08:21 +0000 Subject: [PATCH 5/6] Update activity_serializer.rb --- app/serializers/activity_serializer.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/serializers/activity_serializer.rb b/app/serializers/activity_serializer.rb index 9892fd70d..c731f489f 100644 --- a/app/serializers/activity_serializer.rb +++ b/app/serializers/activity_serializer.rb @@ -14,6 +14,7 @@ class ActivitySerializer end attribute "prov:wasAttributedTo" do |object| + return nil if object.username.blank? url = Rails.env.production? ? "https://api.datacite.org" : "https://api.test.datacite.org" object.username.include?(".") ? url + "/clients/" + object.username : url + "/providers/" + object.username end From 26edf669ffc8909204f435ad780879fe61cc62c5 Mon Sep 17 00:00:00 2001 From: Sarala Wimalaratne Date: Wed, 5 Feb 2020 10:55:44 +0000 Subject: [PATCH 6/6] Update activity_serializer.rb --- app/serializers/activity_serializer.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/serializers/activity_serializer.rb b/app/serializers/activity_serializer.rb index c731f489f..a5f9fc02d 100644 --- a/app/serializers/activity_serializer.rb +++ b/app/serializers/activity_serializer.rb @@ -15,6 +15,7 @@ class ActivitySerializer attribute "prov:wasAttributedTo" do |object| return nil if object.username.blank? + url = Rails.env.production? ? "https://api.datacite.org" : "https://api.test.datacite.org" object.username.include?(".") ? url + "/clients/" + object.username : url + "/providers/" + object.username end