Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DSpace handle to thesis model #706

Merged
merged 1 commit into from
May 17, 2021
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
2 changes: 2 additions & 0 deletions app/dashboards/thesis_dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ThesisDashboard < Administrate::BaseDashboard
coauthors: Field::String,
copyright: Field::BelongsTo,
license: Field::BelongsTo,
dspace_handle: Field::String,
}.freeze

# COLLECTION_ATTRIBUTES
Expand Down Expand Up @@ -74,6 +75,7 @@ class ThesisDashboard < Administrate::BaseDashboard
holds
status
publication_status
dspace_handle
author_note
processor_note
metadata_complete
Expand Down
1 change: 1 addition & 0 deletions app/models/thesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# coauthors :string
# copyright_id :integer
# license_id :integer
# dspace_handle :string
#

class Thesis < ApplicationRecord
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20210511192431_add_dspace_handle_to_thesis.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddDspaceHandleToThesis < ActiveRecord::Migration[6.0]
def change
add_column :theses, :dspace_handle, :string
end
end
3 changes: 2 additions & 1 deletion 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: 2021_03_17_165853) do
ActiveRecord::Schema.define(version: 2021_05_11_192431) do

create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
Expand Down Expand Up @@ -187,6 +187,7 @@
t.string "coauthors"
t.integer "copyright_id"
t.integer "license_id"
t.string "dspace_handle"
t.index ["copyright_id"], name: "index_theses_on_copyright_id"
t.index ["license_id"], name: "index_theses_on_license_id"
end
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/theses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# coauthors :string
# copyright_id :integer
# license_id :integer
# dspace_handle :string
#

# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
Expand Down
8 changes: 8 additions & 0 deletions test/models/thesis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# coauthors :string
# copyright_id :integer
# license_id :integer
# dspace_handle :string
#

require 'csv'
Expand Down Expand Up @@ -254,6 +255,13 @@ class ThesisTest < ActiveSupport::TestCase
assert thesis.valid?
end

test 'can have dspace handle' do
thesis = theses(:one)
thesis.dspace_handle = 'https://example.com/12345.54321'
thesis.save
assert thesis.valid?
end

test 'invalid without files complete' do
thesis = theses(:one)
thesis.files_complete = nil
Expand Down