enju_circulation 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bf9fbe5abcd9d47bea31504e6c9e0e156a794af0
4
- data.tar.gz: 1753a6261b11c688652c5fcff97230b4d40ffc4f
2
+ SHA256:
3
+ metadata.gz: 6b71a1452b3731a885beeb265f9f5d3db20604cb7f4397cdddd9269b4e235a7c
4
+ data.tar.gz: 79273b205450724cc144ac839d09d82069755f5f84fc78f37948ce396ea292a2
5
5
  SHA512:
6
- metadata.gz: 5fdabe08d9d697c68fec4b1ba867dfec33665366e38d17fd4d9a40eb2c357767be2197dc625ef954dbda26f25797935447d728994ecde4cd2571f937c2204ddf
7
- data.tar.gz: 318106fd1014a711022d2334679662c0eb4da05bdfe0916e5cf64918db6801e95b257d4bcafedbcba6528e3b8100af8666e3c91e8ac91fd86061077d64faf2c8
6
+ metadata.gz: 4df0bfd6a17b48bdbdf08177ee991c0f8dcebbe1d6e7237e9f41b7eb39e65b32e7d38c9c0b08bfa41add718bc8f5ec26e29dc364003ef4ef9518d8ca8864f246
7
+ data.tar.gz: f5e812a6fa13aebc8b642d44d78cbb7a303ca761df3afeef33650fdd9820dc3c9cec390b7a551135088d7fa027244d23b4010b1bf70f83f4c4092e3c3e2c9e0c
@@ -27,7 +27,10 @@ module EnjuCirculation
27
27
  'use_restrictions.name' => FOR_CHECKOUT_USE_RESTRICTION
28
28
  ).where(identifier_conditions)
29
29
  }
30
+ scope :on_shelf, -> { includes(:shelf).references(:shelf).where('shelves.name != ?', 'web').where.not(circulation_status_id: CirculationStatus.find_by(name: 'Removed').id) }
31
+ scope :available, -> { includes(:circulation_status).where.not('circulation_statuses.name' => 'Removed') }
30
32
  scope :removed, -> { includes(:circulation_status).where('circulation_statuses.name' => 'Removed') }
33
+
31
34
  has_many :checkouts
32
35
  has_many :reserves
33
36
  has_many :checked_items
@@ -137,7 +137,7 @@ class Reserve < ActiveRecord::Base
137
137
  def retained_by_other_user?
138
138
  return nil if force_retaining == '1'
139
139
  if item && !retained?
140
- if Reserve.retained.where(item_id: item.item_identifier).count > 0
140
+ if Reserve.retained.where(item_id: item.id).count > 0
141
141
  errors[:base] << I18n.t('reserve.attempt_to_update_retained_reservation')
142
142
  end
143
143
  end
@@ -3,7 +3,7 @@ CSV.generate(col_sep: "\t", row_sep: "\r\n") do |csv|
3
3
  @checkouts.each do |checkout|
4
4
  csv << [
5
5
  checkout.user.try(:username),
6
- checkout.user.try(:user_number),
6
+ checkout.user.try(:profile).try(:user_number),
7
7
  checkout.item.item_identifier,
8
8
  checkout.item.manifestation.original_title,
9
9
  checkout.created_at,
@@ -1,3 +1,3 @@
1
1
  module EnjuCirculation
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -6,6 +6,7 @@ end
6
6
 
7
7
  describe EnjuCirculation::EnjuAccept do
8
8
  fixtures :all
9
+
9
10
  it "should successfully accept" do
10
11
  accept = MyAccept.new(FactoryBot.attributes_for(:accept))
11
12
  expect(accept.item).to be_truthy
@@ -14,6 +15,7 @@ describe EnjuCirculation::EnjuAccept do
14
15
  expect(accept.item.circulation_status.name).to eq "Available On Shelf"
15
16
  expect(accept.item.use_restriction.name).to eq "Limited Circulation, Normal Loan Period"
16
17
  end
18
+
17
19
  it "should reflect to items list", solr: true do
18
20
  FactoryBot.create(:item)
19
21
  FactoryBot.create(:item)
@@ -2,4 +2,6 @@
2
2
  module ApplicationHelper
3
3
  include EnjuLeaf::ApplicationHelper
4
4
  include EnjuBiblio::ApplicationHelper
5
+ include EnjuManifestationViewer::ManifestationViewerHelper
6
+ include EnjuManifestationViewer::BookJacketHelper
5
7
  end
@@ -15,3 +15,4 @@ Item.include(EnjuCirculation::EnjuItem)
15
15
  Profile.include(EnjuCirculation::EnjuProfile)
16
16
  Item.include(EnjuLibrary::EnjuItem)
17
17
  UserGroup.include(EnjuCirculation::EnjuUserGroup)
18
+ Withdraw.include(EnjuCirculation::EnjuWithdraw)
@@ -4,6 +4,7 @@ require 'rails/all'
4
4
 
5
5
  Bundler.require(*Rails.groups)
6
6
  require "enju_circulation"
7
+ require "enju_manifestation_viewer"
7
8
  require "enju_leaf"
8
9
 
9
10
  module Dummy
@@ -1,30 +1,25 @@
1
- sqlite: &sqlite
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
2
8
  adapter: sqlite3
3
- database: db/<%= Rails.env %>.sqlite3
4
-
5
- mysql: &mysql
6
- adapter: mysql2
7
- username: root
8
- password:
9
- database: enju_<%= Rails.env %>
10
-
11
- postgresql: &postgresql
12
- adapter: postgresql
13
- username: postgres
14
- password:
15
- database: enju_<%= Rails.env %>
16
-
17
- defaults: &defaults
18
- pool: 5
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
19
10
  timeout: 5000
20
- host: localhost
21
- <<: *<%= ENV['DB'] || "sqlite" %>
22
11
 
23
12
  development:
24
- <<: *defaults
13
+ <<: *default
14
+ database: db/development.sqlite3
25
15
 
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
26
19
  test:
27
- <<: *defaults
20
+ <<: *default
21
+ database: db/test.sqlite3
28
22
 
29
23
  production:
30
- <<: *defaults
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,5 @@
1
+ class AddBookJacketSourceToLibraryGroup < ActiveRecord::Migration[4.2]
2
+ def change
3
+ add_column :library_groups, :book_jacket_source, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddScreenshotGeneratorToLibraryGroup < ActiveRecord::Migration[4.2]
2
+ def change
3
+ add_column :library_groups, :screenshot_generator, :string
4
+ end
5
+ end
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20180107162048) do
13
+ ActiveRecord::Schema.define(version: 2018_01_07_162048) do
14
14
 
15
15
  create_table "accepts", force: :cascade do |t|
16
16
  t.integer "basket_id"
@@ -669,8 +669,10 @@ ActiveRecord::Schema.define(version: 20180107162048) do
669
669
  t.string "url", default: "http://localhost:3000/"
670
670
  t.text "settings"
671
671
  t.text "html_snippet"
672
+ t.string "book_jacket_source"
672
673
  t.integer "max_number_of_results", default: 500
673
674
  t.boolean "family_name_first", default: true
675
+ t.string "screenshot_generator"
674
676
  t.integer "pub_year_facet_range_interval", default: 10
675
677
  t.integer "user_id"
676
678
  t.boolean "csv_charset_conversion", default: false, null: false
@@ -0,0 +1,21 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryBot.define do
4
+ factory :withdraw do
5
+ item_id{FactoryBot.create(:item).id}
6
+ librarian_id{FactoryBot.create(:librarian).id}
7
+ basket_id{FactoryBot.create(:basket, user_id: librarian_id).id}
8
+ end
9
+ end
10
+
11
+ # == Schema Information
12
+ #
13
+ # Table name: withdraws
14
+ #
15
+ # id :integer not null, primary key
16
+ # basket_id :integer
17
+ # item_id :integer
18
+ # librarian_id :integer
19
+ # created_at :datetime not null
20
+ # updated_at :datetime not null
21
+ #
@@ -0,0 +1,35 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Withdraw, type: :model do
4
+ fixtures :all
5
+
6
+ it "should change circulation_status" do
7
+ withdraw = FactoryBot.create(:withdraw)
8
+ withdraw.item.circulation_status.name.should eq 'Removed'
9
+ withdraw.item.use_restriction.name.should eq 'Not For Loan'
10
+ end
11
+
12
+ it "should not withdraw rented item" do
13
+ withdraw = Withdraw.new(librarian: users(:librarian1))
14
+ withdraw.item = items(:item_00013)
15
+ withdraw.valid?.should be_falsy
16
+ end
17
+
18
+ it "should not withdraw reserved item" do
19
+ reserve = FactoryBot.create(:reserve)
20
+ withdraw = FactoryBot.build(:withdraw, item: reserve.manifestation.items.first)
21
+ withdraw.valid?.should be_falsy
22
+ end
23
+ end
24
+
25
+ # == Schema Information
26
+ #
27
+ # Table name: withdraws
28
+ #
29
+ # id :integer not null, primary key
30
+ # basket_id :integer
31
+ # item_id :integer
32
+ # librarian_id :integer
33
+ # created_at :datetime not null
34
+ # updated_at :datetime not null
35
+ #
data/spec/rails_helper.rb CHANGED
@@ -36,6 +36,12 @@ RSpec.configure do |config|
36
36
  config.extend ControllerMacros, type: :controller
37
37
 
38
38
  config.infer_spec_type_from_file_location!
39
+
40
+ config.before(:each) do |example|
41
+ if example.metadata[:type] == :system
42
+ driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
43
+ end
44
+ end
39
45
  end
40
46
 
41
47
  FactoryBot.definition_file_paths << "#{::Rails.root}/../../spec/factories"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_circulation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosuke Tanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-21 00:00:00.000000000 Z
11
+ date: 2019-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: enju_biblio
@@ -16,42 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.0
19
+ version: 0.3.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.0
26
+ version: 0.3.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: enju_manifestation_viewer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: enju_event
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 0.3.1
47
+ version: 0.3.2
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 0.3.1
54
+ version: 0.3.2
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: capybara
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '3.3'
61
+ version: '3.11'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '3.3'
68
+ version: '3.11'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: coveralls
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +86,14 @@ dependencies:
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 1.3.0
89
+ version: 1.3.2
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 1.3.0
96
+ version: 1.3.2
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: factory_bot_rails
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +184,14 @@ dependencies:
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: '3.7'
187
+ version: '3.8'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: '3.7'
194
+ version: '3.8'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: simplecov
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -220,6 +234,34 @@ dependencies:
220
234
  - - "~>"
221
235
  - !ruby/object:Gem::Version
222
236
  version: '2.3'
237
+ - !ruby/object:Gem::Dependency
238
+ name: selenium-webdriver
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: puma
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
223
265
  description: Circulation management for Next-L Enju
224
266
  email:
225
267
  - nabeta@fastmail.fm
@@ -731,8 +773,10 @@ files:
731
773
  - spec/dummy/db/migrate/20160801080637_add_most_recent_to_resource_export_file_transitions.rb
732
774
  - spec/dummy/db/migrate/20160801080643_add_most_recent_to_agent_import_file_transitions.rb
733
775
  - spec/dummy/db/migrate/20160811102604_add_picture_width_to_picture_file.rb
776
+ - spec/dummy/db/migrate/20160813191533_add_book_jacket_source_to_library_group.rb
734
777
  - spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb
735
778
  - spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb
779
+ - spec/dummy/db/migrate/20160813191820_add_screenshot_generator_to_library_group.rb
736
780
  - spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb
737
781
  - spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb
738
782
  - spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb
@@ -782,6 +826,7 @@ files:
782
826
  - spec/factories/user_group.rb
783
827
  - spec/factories/user_group_has_checkout_type.rb
784
828
  - spec/factories/user_reserve_stat.rb
829
+ - spec/factories/withdraw.rb
785
830
  - spec/fixtures/agent_types.yml
786
831
  - spec/fixtures/agents.yml
787
832
  - spec/fixtures/baskets.yml
@@ -849,6 +894,7 @@ files:
849
894
  - spec/models/user_group_has_checkout_type_spec.rb
850
895
  - spec/models/user_reserve_stat_spec.rb
851
896
  - spec/models/user_spec.rb
897
+ - spec/models/withdraw_spec.rb
852
898
  - spec/rails_helper.rb
853
899
  - spec/routing/checked_items_routing_spec.rb
854
900
  - spec/spec_helper.rb
@@ -890,8 +936,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
890
936
  - !ruby/object:Gem::Version
891
937
  version: '0'
892
938
  requirements: []
893
- rubyforge_project:
894
- rubygems_version: 2.6.14.3
939
+ rubygems_version: 3.0.3
895
940
  signing_key:
896
941
  specification_version: 4
897
942
  summary: enju_circulation plugin
@@ -1106,6 +1151,7 @@ test_files:
1106
1151
  - spec/dummy/db/migrate/20090705212043_add_attachments_attachment_to_manifestation.rb
1107
1152
  - spec/dummy/db/migrate/20140628071719_add_user_encoding_to_event_import_file.rb
1108
1153
  - spec/dummy/db/migrate/012_create_owns.rb
1154
+ - spec/dummy/db/migrate/20160813191533_add_book_jacket_source_to_library_group.rb
1109
1155
  - spec/dummy/db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb
1110
1156
  - spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb
1111
1157
  - spec/dummy/db/migrate/002_devise_create_users.rb
@@ -1128,6 +1174,7 @@ test_files:
1128
1174
  - spec/dummy/db/migrate/20140823083524_add_extent_to_manifestation.rb
1129
1175
  - spec/dummy/db/migrate/20130506175303_create_identifier_types.rb
1130
1176
  - spec/dummy/db/migrate/20130509185724_add_statement_of_responsibility_to_manifestation.rb
1177
+ - spec/dummy/db/migrate/20160813191820_add_screenshot_generator_to_library_group.rb
1131
1178
  - spec/dummy/db/migrate/113_create_events.rb
1132
1179
  - spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb
1133
1180
  - spec/dummy/db/migrate/20140813182425_add_publication_place_to_manifestation.rb
@@ -1135,6 +1182,7 @@ test_files:
1135
1182
  - spec/models/item_has_use_resetriction_spec.rb
1136
1183
  - spec/models/reserve_spec.rb
1137
1184
  - spec/models/carrier_type_has_checkout_type_spec.rb
1185
+ - spec/models/withdraw_spec.rb
1138
1186
  - spec/models/user_reserve_stat_spec.rb
1139
1187
  - spec/models/checkout_type_spec.rb
1140
1188
  - spec/models/checkout_stat_has_manifestation_spec.rb
@@ -1178,6 +1226,7 @@ test_files:
1178
1226
  - spec/factories/circulation_status.rb
1179
1227
  - spec/factories/item_has_use_restriction.rb
1180
1228
  - spec/factories/profile.rb
1229
+ - spec/factories/withdraw.rb
1181
1230
  - spec/factories/user_reserve_stat.rb
1182
1231
  - spec/factories/reserve_stat_has_user.rb
1183
1232
  - spec/factories/user_group.rb