enju_circulation 0.4.0.beta.2 → 0.4.0.beta.3

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
2
  SHA256:
3
- metadata.gz: ee71223ba0f27699750432bf7e8774bf5bff25fed58580e235ef66e20979ff95
4
- data.tar.gz: 5c22855394daeae8c129c79589eb4da20a6bb810bfdf5e50be9463ac2fed7b69
3
+ metadata.gz: f8001e1100fd98ad9e9add777f6d37d4cb1a666e6ffd39c49f807f91137d4925
4
+ data.tar.gz: 8999dd13fc093409a448c997a0781f9ba49e715e569e6b33f2f46c33e3f82da8
5
5
  SHA512:
6
- metadata.gz: f6fa2f76cd44df019ee604d30435bda3bb70d756270954de18efd372994f43e3a54e6e3b392521eb47973abf6ccf46eda7ffc07ebbfd4645d7e822200587b5a3
7
- data.tar.gz: '0883d232402ea5cd43249e774fc179aab8d149e6dfcbf533fe3aeb3e13091f77fad7e3ed26c5cb600ecffde456dd89f4e50be70099b28b28fd564ab927bbe3b6'
6
+ metadata.gz: 5d03d25ba16f1705333eb1043f1a143d65584efef4876c0327baaba17926f8dbb6a01215704b2ddb828d7859f620c439dc4a4901eb9152e5ea426d98ed270298
7
+ data.tar.gz: 692f9d4df457829e3d0298a59cde582030449a9a6b8ca676bcbc27135ac0e251d16f93fefdd0d5bf26f411afaef77979f2c90f7a254e9d5fb01d4cba5785c09b
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # EnjuCirculation
2
- [![CircleCI](https://circleci.com/gh/next-l/enju_circulation/tree/2.x.svg?style=svg)](https://circleci.com/gh/next-l/enju_circulation/tree/2.x)
2
+ ![](https://github.com/next-l/enju_circulation/workflows/Ruby/badge.svg?branch=2.x)
3
3
  [![Coverage Status](https://coveralls.io/repos/github/next-l/enju_circulation/badge.svg?branch=2.x)](https://coveralls.io/github/next-l/enju_circulation?branch=2.x)
4
4
 
5
5
  This project rocks and uses MIT-LICENSE.
@@ -1,5 +1,8 @@
1
1
  class ManifestationCheckoutStat < ApplicationRecord
2
- include Statesman::Adapters::ActiveRecordQueries
2
+ include Statesman::Adapters::ActiveRecordQueries[
3
+ transition_class: ManifestationCheckoutStatTransition,
4
+ initial_state: :pending
5
+ ]
3
6
  include CalculateStat
4
7
  default_scope {order('manifestation_checkout_stats.id DESC')}
5
8
  scope :not_calculated, -> {in_state(:pending)}
@@ -1,5 +1,8 @@
1
1
  class ManifestationReserveStat < ApplicationRecord
2
- include Statesman::Adapters::ActiveRecordQueries
2
+ include Statesman::Adapters::ActiveRecordQueries[
3
+ transition_class: ManifestationReserveStatTransition,
4
+ initial_state: :pending
5
+ ]
3
6
  include CalculateStat
4
7
  default_scope {order('manifestation_reserve_stats.id DESC')}
5
8
  scope :not_calculated, -> {in_state(:pending)}
@@ -1,5 +1,8 @@
1
1
  class Reserve < ApplicationRecord
2
- include Statesman::Adapters::ActiveRecordQueries
2
+ include Statesman::Adapters::ActiveRecordQueries[
3
+ transition_class: ReserveTransition,
4
+ initial_state: :pending
5
+ ]
3
6
  scope :hold, -> { where('item_id IS NOT NULL') }
4
7
  scope :not_hold, -> { where(item_id: nil) }
5
8
  scope :waiting, -> {not_in_state(:completed, :expired, :retained).where('canceled_at IS NULL AND (expired_at > ? OR expired_at IS NULL)', Time.zone.now).order('reserves.id DESC')}
@@ -1,5 +1,8 @@
1
1
  class UserCheckoutStat < ApplicationRecord
2
- include Statesman::Adapters::ActiveRecordQueries
2
+ include Statesman::Adapters::ActiveRecordQueries[
3
+ transition_class: UserCheckoutStatTransition,
4
+ initial_state: :pending
5
+ ]
3
6
  include CalculateStat
4
7
  default_scope {order('user_checkout_stats.id DESC')}
5
8
  scope :not_calculated, -> {in_state(:pending)}
@@ -1,5 +1,8 @@
1
1
  class UserReserveStat < ApplicationRecord
2
- include Statesman::Adapters::ActiveRecordQueries
2
+ include Statesman::Adapters::ActiveRecordQueries[
3
+ transition_class: UserReserveStatTransition,
4
+ initial_state: :pending
5
+ ]
3
6
  include CalculateStat
4
7
  default_scope {order('user_reserve_stats.id DESC')}
5
8
  scope :not_calculated, -> {in_state(:pending)}
@@ -12,7 +12,7 @@
12
12
  <br />
13
13
  (
14
14
  <%= t('activerecord.attributes.checkout.due_date') -%>:
15
- <%= l(item.latest_checkout.due_date, format: :short) -%>
15
+ <%= l(item.latest_checkout.due_date, format: :only_date) -%>
16
16
  )
17
17
  <% end %>
18
18
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module EnjuCirculation
2
- VERSION = "0.4.0.beta.2"
2
+ VERSION = "0.4.0.beta.3"
3
3
  end
@@ -0,0 +1,57 @@
1
+ # NOTE: only doing this in development as some production environments (Heroku)
2
+ # NOTE: are sensitive to local FS writes, and besides -- it's just not proper
3
+ # NOTE: to have a dev-mode tool do its thing in production.
4
+ if Rails.env.development?
5
+ require 'annotate'
6
+ task :set_annotation_options do
7
+ # You can override any of these by setting an environment variable of the
8
+ # same name.
9
+ Annotate.set_defaults(
10
+ 'additional_file_patterns' => [],
11
+ 'routes' => 'false',
12
+ 'models' => 'true',
13
+ 'position_in_routes' => 'after',
14
+ 'position_in_class' => 'after',
15
+ 'position_in_test' => 'after',
16
+ 'position_in_fixture' => 'after',
17
+ 'position_in_factory' => 'after',
18
+ 'position_in_serializer' => 'after',
19
+ 'show_foreign_keys' => 'true',
20
+ 'show_complete_foreign_keys' => 'false',
21
+ 'show_indexes' => 'true',
22
+ 'simple_indexes' => 'false',
23
+ 'model_dir' => 'app/models',
24
+ 'root_dir' => '',
25
+ 'include_version' => 'false',
26
+ 'require' => '',
27
+ 'exclude_tests' => 'false',
28
+ 'exclude_fixtures' => 'false',
29
+ 'exclude_factories' => 'false',
30
+ 'exclude_serializers' => 'false',
31
+ 'exclude_scaffolds' => 'true',
32
+ 'exclude_controllers' => 'true',
33
+ 'exclude_helpers' => 'true',
34
+ 'exclude_sti_subclasses' => 'false',
35
+ 'ignore_model_sub_dir' => 'false',
36
+ 'ignore_columns' => nil,
37
+ 'ignore_routes' => nil,
38
+ 'ignore_unknown_models' => 'false',
39
+ 'hide_limit_column_types' => 'integer,bigint,boolean',
40
+ 'hide_default_column_types' => 'json,jsonb,hstore',
41
+ 'skip_on_db_migrate' => 'false',
42
+ 'format_bare' => 'true',
43
+ 'format_rdoc' => 'false',
44
+ 'format_markdown' => 'false',
45
+ 'sort' => 'false',
46
+ 'force' => 'false',
47
+ 'frozen' => 'false',
48
+ 'classified_sort' => 'true',
49
+ 'trace' => 'false',
50
+ 'wrapper_open' => nil,
51
+ 'wrapper_close' => nil,
52
+ 'with_comment' => 'true'
53
+ )
54
+ end
55
+
56
+ Annotate.load_tasks
57
+ end
@@ -38,8 +38,8 @@ namespace :enju_circulation do
38
38
  Checkout.send_overdue_notification
39
39
  end
40
40
 
41
- desc "upgrade enju_circulation"
42
- task upgrade: :environment do
41
+ desc "upgrade enju_circulation to 1.3"
42
+ task upgrade_to_13: :environment do
43
43
  Rake::Task['statesman:backfill_most_recent'].invoke('ManifestationCheckoutStat')
44
44
  Rake::Task['statesman:backfill_most_recent'].invoke('ManifestationReserveStat')
45
45
  Rake::Task['statesman:backfill_most_recent'].invoke('UserCheckoutStat')
@@ -78,4 +78,23 @@ namespace :enju_circulation do
78
78
  end
79
79
  end
80
80
  end
81
+
82
+ desc "upgrade enju_circulation to 2.0"
83
+ task upgrade: :environment do
84
+ sql = 'UPDATE checkins SET checkout_id = checkouts.id FROM checkouts WHERE checkouts.checkin_id = checkins.id;'
85
+ ActiveRecord::Base.connection.execute(sql)
86
+
87
+ class_names = [
88
+ CheckoutType, CirculationStatus, UseRestriction
89
+ ]
90
+ class_names.each do |klass|
91
+ klass.find_each do |record|
92
+ I18n.available_locales.each do |locale|
93
+ next unless record.respond_to?("display_name_#{locale}")
94
+ record.update("display_name_#{locale}": YAML.safe_load(record[:display_name])[locale.to_s])
95
+ end
96
+ end
97
+ end
98
+ puts 'enju_circulation: The upgrade completed successfully.'
99
+ end
81
100
  end
@@ -0,0 +1,5 @@
1
+ class AddMemoToManifestation < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :manifestations, :memo, :text
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddMemoToItem < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :items, :memo, :text
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: 2019_08_16_102803) do
13
+ ActiveRecord::Schema.define(version: 2019_08_18_075628) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
@@ -599,6 +599,7 @@ ActiveRecord::Schema.define(version: 2019_08_16_102803) do
599
599
  t.string "binding_call_number"
600
600
  t.datetime "binded_at"
601
601
  t.integer "manifestation_id", null: false
602
+ t.text "memo"
602
603
  t.index ["binding_item_identifier"], name: "index_items_on_binding_item_identifier"
603
604
  t.index ["bookstore_id"], name: "index_items_on_bookstore_id"
604
605
  t.index ["checkout_type_id"], name: "index_items_on_checkout_type_id"
@@ -829,6 +830,7 @@ ActiveRecord::Schema.define(version: 2019_08_16_102803) do
829
830
  t.text "publication_place"
830
831
  t.text "extent"
831
832
  t.text "dimensions"
833
+ t.text "memo"
832
834
  t.index ["access_address"], name: "index_manifestations_on_access_address"
833
835
  t.index ["date_of_publication"], name: "index_manifestations_on_date_of_publication"
834
836
  t.index ["manifestation_identifier"], name: "index_manifestations_on_manifestation_identifier"
@@ -852,7 +854,8 @@ ActiveRecord::Schema.define(version: 2019_08_16_102803) do
852
854
  t.integer "message_request_id"
853
855
  t.datetime "created_at"
854
856
  t.datetime "updated_at"
855
- t.boolean "most_recent"
857
+ t.boolean "most_recent", null: false
858
+ t.index ["message_request_id", "most_recent"], name: "index_message_request_transitions_parent_most_recent", unique: true, where: "most_recent"
856
859
  t.index ["message_request_id"], name: "index_message_request_transitions_on_message_request_id"
857
860
  t.index ["sort_key", "message_request_id"], name: "index_message_request_transitions_on_sort_key_and_request_id", unique: true
858
861
  end
@@ -886,7 +889,8 @@ ActiveRecord::Schema.define(version: 2019_08_16_102803) do
886
889
  t.integer "message_id"
887
890
  t.datetime "created_at"
888
891
  t.datetime "updated_at"
889
- t.boolean "most_recent"
892
+ t.boolean "most_recent", null: false
893
+ t.index ["message_id", "most_recent"], name: "index_message_transitions_parent_most_recent", unique: true, where: "most_recent"
890
894
  t.index ["message_id"], name: "index_message_transitions_on_message_id"
891
895
  t.index ["sort_key", "message_id"], name: "index_message_transitions_on_sort_key_and_message_id", unique: true
892
896
  end
@@ -0,0 +1,14 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe 'UserGroupHasCheckoutType', type: :system do
4
+ include Devise::Test::IntegrationHelpers
5
+ fixtures :all
6
+
7
+ describe 'When logged in as Librarian' do
8
+ it 'should render' do
9
+ sign_in users(:librarian1)
10
+ visit edit_user_group_has_checkout_path(user_group_has_checkout_types(:user_group_has_checkout_type_00001))
11
+ expect(page).to have_field :user_group_id
12
+ end
13
+ end
14
+ end
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.4.0.beta.2
4
+ version: 0.4.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosuke Tanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-17 00:00:00.000000000 Z
11
+ date: 2019-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: enju_biblio
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.0.beta.1
19
+ version: 0.4.0.beta.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.4.0.beta.1
26
+ version: 0.4.0.beta.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: enju_manifestation_viewer
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.4.0.beta.1
47
+ version: 0.4.0.beta.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.4.0.beta.1
54
+ version: 0.4.0.beta.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: enju_leaf
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -528,6 +528,7 @@ files:
528
528
  - lib/generators/enju_circulation/setup/templates/db/fixtures/checkout_types.yml
529
529
  - lib/generators/enju_circulation/setup/templates/db/fixtures/circulation_statuses.yml
530
530
  - lib/generators/enju_circulation/setup/templates/db/fixtures/use_restrictions.yml
531
+ - lib/tasks/auto_annotate_models.rake
531
532
  - lib/tasks/checkout.rb
532
533
  - lib/tasks/circulation_status.rb
533
534
  - lib/tasks/enju_circulation_tasks.rake
@@ -800,6 +801,8 @@ files:
800
801
  - spec/dummy/db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb
801
802
  - spec/dummy/db/migrate/20190713114940_add_profile_id_to_user.rb
802
803
  - spec/dummy/db/migrate/20190713115451_add_full_name_translations_to_profile.rb
804
+ - spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb
805
+ - spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb
803
806
  - spec/dummy/db/schema.rb
804
807
  - spec/dummy/db/test.sqlite3
805
808
  - spec/dummy/public/404.html
@@ -916,6 +919,7 @@ files:
916
919
  - spec/system/checkouts_spec.rb
917
920
  - spec/system/manifestations_spec.rb
918
921
  - spec/system/reserves_spec.rb
922
+ - spec/system/user_group_has_checkout_types.rb
919
923
  - spec/tasks/export_checkout_spec.rb
920
924
  - spec/views/checked_items/new.html.erb_spec.rb
921
925
  - spec/views/checkout_types/edit.html.erb_spec.rb
@@ -1111,6 +1115,7 @@ test_files:
1111
1115
  - spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb
1112
1116
  - spec/dummy/db/migrate/20100129142347_create_import_requests.rb
1113
1117
  - spec/dummy/db/migrate/125_create_donates.rb
1118
+ - spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb
1114
1119
  - spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb
1115
1120
  - spec/dummy/db/migrate/20180107161331_add_constraints_to_most_recent_for_resource_import_file_transitions.rb
1116
1121
  - spec/dummy/db/migrate/20081028083142_create_agent_import_files.rb
@@ -1195,6 +1200,7 @@ test_files:
1195
1200
  - spec/dummy/db/migrate/20160811102604_add_picture_width_to_picture_file.rb
1196
1201
  - spec/dummy/db/migrate/20130429020822_add_root_manifestation_id_to_series_statement.rb
1197
1202
  - spec/dummy/db/migrate/20090705133942_add_attachments_picture_to_picture_file.rb
1203
+ - spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb
1198
1204
  - spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb
1199
1205
  - spec/dummy/db/migrate/20120511072422_add_agent_identifier_to_agent.rb
1200
1206
  - spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb
@@ -1241,6 +1247,7 @@ test_files:
1241
1247
  - spec/models/accept_spec.rb
1242
1248
  - spec/models/basket_spec.rb
1243
1249
  - spec/policies/manifestation_policy_spec.rb
1250
+ - spec/system/user_group_has_checkout_types.rb
1244
1251
  - spec/system/manifestations_spec.rb
1245
1252
  - spec/system/checkouts_spec.rb
1246
1253
  - spec/system/reserves_spec.rb