enju_circulation 0.1.0.pre38 → 0.1.0.pre39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/manifestation_checkout_stats_controller.rb +3 -0
  3. data/app/models/carrier_type_has_checkout_type.rb +2 -2
  4. data/app/models/checkin.rb +7 -5
  5. data/app/models/checkout.rb +11 -7
  6. data/app/models/checkout_type.rb +3 -3
  7. data/app/models/circulation_status.rb +6 -5
  8. data/app/models/item_has_use_restriction.rb +1 -1
  9. data/app/models/lending_policy.rb +1 -1
  10. data/app/models/manifestation_checkout_stat.rb +1 -1
  11. data/app/models/manifestation_reserve_stat.rb +1 -1
  12. data/app/models/reserve.rb +19 -19
  13. data/app/models/use_restriction.rb +5 -4
  14. data/app/models/user_group_has_checkout_type.rb +1 -1
  15. data/app/views/checked_items/new.html.erb +1 -1
  16. data/app/views/checkouts/_index_user.html.erb +1 -1
  17. data/app/views/manifestation_checkout_stats/show.html.erb +9 -0
  18. data/app/views/manifestation_checkout_stats/show.txt.erb +3 -2
  19. data/app/views/manifestation_reserve_stats/show.txt.erb +3 -2
  20. data/config/locales/translation_en.yml +1 -0
  21. data/config/locales/translation_ja.yml +1 -0
  22. data/lib/enju_circulation/item.rb +3 -3
  23. data/lib/enju_circulation/user_group.rb +2 -2
  24. data/lib/enju_circulation/version.rb +1 -1
  25. data/spec/controllers/checkout_types_controller_spec.rb +2 -2
  26. data/spec/controllers/circulation_statuses_controller_spec.rb +4 -4
  27. data/spec/controllers/item_has_use_restrictions_controller_spec.rb +2 -2
  28. data/spec/controllers/manifestation_checkout_stats_controller_spec.rb +4 -4
  29. data/spec/controllers/manifestation_reserve_stats_controller_spec.rb +4 -4
  30. data/spec/controllers/use_restrictions_controller_spec.rb +2 -2
  31. data/spec/controllers/user_checkout_stats_controller_spec.rb +4 -4
  32. data/spec/controllers/user_reserve_stats_controller_spec.rb +4 -4
  33. data/spec/dummy/config/boot.rb +2 -2
  34. data/spec/dummy/config/initializers/friendly_id.rb +90 -0
  35. data/spec/dummy/db/migrate/005_create_manifestations.rb +0 -1
  36. data/spec/dummy/db/migrate/133_create_agent_merges.rb +15 -0
  37. data/spec/dummy/db/migrate/134_create_agent_merge_lists.rb +13 -0
  38. data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +0 -1
  39. data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +1 -1
  40. data/spec/dummy/db/migrate/20140813182425_add_publication_place_to_manifestation.rb +5 -0
  41. data/spec/dummy/db/migrate/20140822114527_add_error_message_to_resource_import_result.rb +5 -0
  42. data/spec/dummy/db/migrate/20140823083524_add_extent_to_manifestation.rb +5 -0
  43. data/spec/dummy/db/migrate/20140823094847_add_dimensions_to_manifestation.rb +5 -0
  44. data/spec/dummy/db/migrate/20140823095740_rename_manifestation_periodical_to_serial.rb +9 -0
  45. data/spec/dummy/db/schema.rb +23 -5
  46. data/spec/dummy/db/test.sqlite3 +0 -0
  47. data/spec/dummy/solr/default/data/index/_8df.fdt +0 -0
  48. data/spec/dummy/solr/default/data/index/{_7tr.si → _8df.si} +0 -0
  49. data/spec/dummy/solr/default/data/index/{_7tr_Lucene41_0.tim → _8df_Lucene41_0.tim} +0 -0
  50. data/spec/dummy/solr/default/data/index/{_7tr_Lucene41_0.tip → _8df_Lucene41_0.tip} +0 -0
  51. data/spec/dummy/solr/default/data/index/segments.gen +0 -0
  52. data/spec/dummy/solr/default/data/index/segments_dfb +0 -0
  53. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000017389 +0 -0
  54. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000017390 +0 -0
  55. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000017391 +0 -0
  56. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000017392 +0 -0
  57. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000017393 +0 -0
  58. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000017394 +0 -0
  59. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000017395 +0 -0
  60. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000017396 +0 -0
  61. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000017397 +0 -0
  62. data/spec/dummy/tmp/cache/stdout +27 -1875
  63. data/spec/dummy/tmp/pids/redis-test.pid +1 -1
  64. data/spec/fixtures/users.yml +1 -1
  65. data/spec/models/reserve_spec.rb +2 -2
  66. data/spec/views/reserves/index.html.erb_spec.rb +1 -1
  67. metadata +68 -153
  68. data/lib/generators/enju_circulation/setup/templates/db/fixtures/carrier_types.yml +0 -29
  69. data/spec/dummy/solr/default/data/index/_7tr.fdt +0 -0
  70. data/spec/dummy/solr/default/data/index/segments_cjn +0 -0
  71. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000016249 +0 -0
  72. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000016250 +0 -0
  73. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000016251 +0 -0
  74. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000016252 +0 -0
  75. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000016253 +0 -0
  76. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000016254 +0 -0
  77. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000016255 +0 -0
  78. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000016256 +0 -0
  79. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000016257 +0 -0
  80. data/spec/dummy/tmp/cache/assets/test/sprockets/0007f9aec08cc2727b3d00cd62cf1d0f +0 -0
  81. data/spec/dummy/tmp/cache/assets/test/sprockets/0440b81b0aae840cf287a686585a8cec +0 -0
  82. data/spec/dummy/tmp/cache/assets/test/sprockets/0e3e358e4fe4601ba5e435f6d0c86f12 +0 -0
  83. data/spec/dummy/tmp/cache/assets/test/sprockets/129cec5384c0f26fcfb0ce65048298c5 +0 -0
  84. data/spec/dummy/tmp/cache/assets/test/sprockets/1572dfd6f1e555f4be1aa60ddc3cb0c0 +0 -0
  85. data/spec/dummy/tmp/cache/assets/test/sprockets/181c975b1296d7ebe81714d5e64bc098 +0 -0
  86. data/spec/dummy/tmp/cache/assets/test/sprockets/1c1fbab93e4552626da626e0dbe70c74 +0 -0
  87. data/spec/dummy/tmp/cache/assets/test/sprockets/1e58a07a3701da9fb9c176d67162af2b +0 -0
  88. data/spec/dummy/tmp/cache/assets/test/sprockets/2b35ad8fee7e1228e205669278e2adda +0 -0
  89. data/spec/dummy/tmp/cache/assets/test/sprockets/2f09f58943a88f21e3a0318621391785 +0 -0
  90. data/spec/dummy/tmp/cache/assets/test/sprockets/2ffe508d0533d0afd2a37bb574eda40d +0 -0
  91. data/spec/dummy/tmp/cache/assets/test/sprockets/3753d928863ee65118b9f2da1c6e504d +0 -0
  92. data/spec/dummy/tmp/cache/assets/test/sprockets/40e90f0c329b14292a9ff1a2fe907b39 +0 -0
  93. data/spec/dummy/tmp/cache/assets/test/sprockets/45f3c74e1e31b58d9bda6908d5623290 +0 -0
  94. data/spec/dummy/tmp/cache/assets/test/sprockets/49a3464eb6bcffb3d9f5b47b133edabb +0 -0
  95. data/spec/dummy/tmp/cache/assets/test/sprockets/49d32c13d390c1b80d8b2705aac86579 +0 -0
  96. data/spec/dummy/tmp/cache/assets/test/sprockets/4aa18096a209e515f5f1df487622cdf4 +0 -0
  97. data/spec/dummy/tmp/cache/assets/test/sprockets/50e64f45f0cb4cee52fd3f3908f89a82 +0 -0
  98. data/spec/dummy/tmp/cache/assets/test/sprockets/51f7d34a9e9bebb47b7201cfebfec34d +0 -0
  99. data/spec/dummy/tmp/cache/assets/test/sprockets/5995180d1cfd7cad71ec6d9e1a538f0e +0 -0
  100. data/spec/dummy/tmp/cache/assets/test/sprockets/604e0e4b3c01d488d6fb087e9fdaeb94 +0 -0
  101. data/spec/dummy/tmp/cache/assets/test/sprockets/6401fc09d2b894df2ad251b007df145a +0 -0
  102. data/spec/dummy/tmp/cache/assets/test/sprockets/65a8d4d288e5f082f0166aa7be7a2464 +0 -0
  103. data/spec/dummy/tmp/cache/assets/test/sprockets/6f5d66df18892df6af39c9cfd784f0f5 +0 -0
  104. data/spec/dummy/tmp/cache/assets/test/sprockets/6fcdd2234a7c25f9d4179ca12fd9f7b4 +0 -0
  105. data/spec/dummy/tmp/cache/assets/test/sprockets/6fdb4513af157010ef79b56df44d665e +0 -0
  106. data/spec/dummy/tmp/cache/assets/test/sprockets/750439d8043ed022910956fbb55faa65 +0 -0
  107. data/spec/dummy/tmp/cache/assets/test/sprockets/811e5198d0dc4efe02d28c0c2215e207 +0 -0
  108. data/spec/dummy/tmp/cache/assets/test/sprockets/83ea20e0b25e77f5dce5bf733b088292 +0 -0
  109. data/spec/dummy/tmp/cache/assets/test/sprockets/9604073a83f822f13caaabd7e157bbbb +0 -0
  110. data/spec/dummy/tmp/cache/assets/test/sprockets/98d02556564ee10aef4c3397bb94d5b9 +0 -0
  111. data/spec/dummy/tmp/cache/assets/test/sprockets/9cfe4d48f5258863dbfb3623c797fb15 +0 -0
  112. data/spec/dummy/tmp/cache/assets/test/sprockets/a296264dcc89e1f8ab6382e678ffbe38 +0 -0
  113. data/spec/dummy/tmp/cache/assets/test/sprockets/aa2e1ada35daa496bb08e85fcb817536 +0 -0
  114. data/spec/dummy/tmp/cache/assets/test/sprockets/abee2d4cb18d15789dcdc9c680f3e6de +0 -0
  115. data/spec/dummy/tmp/cache/assets/test/sprockets/c1ab0ecf3cf57db41d9e4cd9306d8829 +0 -0
  116. data/spec/dummy/tmp/cache/assets/test/sprockets/c4a984c6feb506f3e1f9120a8d029bda +0 -0
  117. data/spec/dummy/tmp/cache/assets/test/sprockets/ccdcb26ebc6ef3b684368b368edf4f99 +0 -0
  118. data/spec/dummy/tmp/cache/assets/test/sprockets/d34b5413caa9407126db68d5d590804a +0 -0
  119. data/spec/dummy/tmp/cache/assets/test/sprockets/d4ac74c17332ad931b72f42d7997fcc0 +0 -0
  120. data/spec/dummy/tmp/cache/assets/test/sprockets/dd672deb061233e0db1d2f413d27213f +0 -0
  121. data/spec/dummy/tmp/cache/assets/test/sprockets/e1fcfb0faa3c12467a1c35251e04c8b1 +0 -0
  122. data/spec/dummy/tmp/cache/assets/test/sprockets/e2d21478696ac96ad895f7c3b8d31594 +0 -0
  123. data/spec/dummy/tmp/cache/assets/test/sprockets/e577e9ce00153ad2e59111f761d0fb15 +0 -0
  124. data/spec/dummy/tmp/cache/assets/test/sprockets/e9738177de2083b68d42e053a1529244 +0 -0
  125. data/spec/dummy/tmp/cache/assets/test/sprockets/e9ce2df3f0160329df69b22a911dbd04 +0 -0
  126. data/spec/dummy/tmp/cache/assets/test/sprockets/f2e83d3b5fe984832bfeff09b0e3b8d2 +0 -0
  127. data/spec/dummy/tmp/cache/assets/test/sprockets/f90eee17e0e5eaea50e6064ded54617c +0 -0
  128. data/spec/dummy/tmp/cache/assets/test/sprockets/fa8e81ce1d45228121b9df5618542190 +0 -0
  129. data/spec/dummy/tmp/cache/assets/test/sprockets/fbdc1d9347cb228f06807b76c6c2974e +0 -0
  130. /data/spec/dummy/solr/default/data/index/{_7tr.fdx → _8df.fdx} +0 -0
  131. /data/spec/dummy/solr/default/data/index/{_7tr.fnm → _8df.fnm} +0 -0
  132. /data/spec/dummy/solr/default/data/index/{_7tr.nvd → _8df.nvd} +0 -0
  133. /data/spec/dummy/solr/default/data/index/{_7tr.nvm → _8df.nvm} +0 -0
  134. /data/spec/dummy/solr/default/data/index/{_7tr_Lucene41_0.doc → _8df_Lucene41_0.doc} +0 -0
  135. /data/spec/dummy/solr/default/data/index/{_7tr_Lucene41_0.pos → _8df_Lucene41_0.pos} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a351d924a626f215711e04a84233a743723855c
4
- data.tar.gz: ffd37f15ff29d2c38f2c80b238cf7e67f3866d08
3
+ metadata.gz: eaf9300fdaa9bc2f1f6f3fee23050f624b893b53
4
+ data.tar.gz: 069d5d5de77d66c9f7eda705096ff3eb8d46a019
5
5
  SHA512:
6
- metadata.gz: 903430be5e4584e3cfb17e2854458d6ebf68334f7b91f42c5d12f3d2c18a5e7eade3eeb67aa877d51786785e5dad5087acf484b1233fe20ab44c911745e0613f
7
- data.tar.gz: 89158339d97c670bf648d111f12aac3d3696d5922f541486f8ad20b9936686c08a5a2e49d4419ede7a414c08469468731715249f92902c085a51644c3cf8f571
6
+ metadata.gz: 090251723f0115166b1a8b71667f50700d6181196b6fb7afc0b490a218825bb69e2b3af7f78894c4e58554a8d159599eaf7d2f8482378c966c2866988f82eb35
7
+ data.tar.gz: b389ad232f0ce25a21c1977a97d3b3f3d526ea87f4bba6607f94e19053a75d4b75324d7c439d07ddc91233a78e63af23fba443b69de3f75beda6f6a1f3726df7
@@ -22,6 +22,9 @@ class ManifestationCheckoutStatsController < ApplicationController
22
22
  per_page = CheckoutStatHasManifestation.default_per_page
23
23
  end
24
24
  @stats = @manifestation_checkout_stat.checkout_stat_has_manifestations.order('checkouts_count DESC, manifestation_id').page(params[:page]).per(per_page)
25
+ @breakdown = CheckoutStatHasManifestation.joins(:manifestation).where(
26
+ manifestation_checkout_stat_id: @manifestation_checkout_stat.id
27
+ ).group(:carrier_type_id).sum(:checkouts_count)
25
28
 
26
29
  respond_to do |format|
27
30
  format.html # show.html.erb
@@ -1,7 +1,7 @@
1
1
  class CarrierTypeHasCheckoutType < ActiveRecord::Base
2
2
  attr_accessible :carrier_type_id, :checkout_type_id, :note
3
- scope :available_for_carrier_type, lambda {|carrier_type| {:include => :carrier_type, conditions: ['carrier_types.name = ?', carrier_type.name]}}
4
- scope :available_for_user_group, lambda {|user_group| {:include => {:checkout_type => :user_groups}, conditions: ['user_groups.name = ?', user_group.name]}}
3
+ scope :available_for_carrier_type, lambda {|carrier_type| includes(:carrier_type).where('carrier_types.name = ?', carrier_type.name)}
4
+ scope :available_for_user_group, lambda {|user_group| includes(checkout_type: :user_groups).where('user_groups.name = ?', user_group.name)}
5
5
 
6
6
  belongs_to :carrier_type, validate: true
7
7
  belongs_to :checkout_type, validate: true
@@ -1,7 +1,7 @@
1
1
  class Checkin < ActiveRecord::Base
2
2
  attr_accessible :item_identifier
3
- default_scope order: 'checkins.id DESC'
4
- scope :on, lambda {|date| {conditions: ['created_at >= ? AND created_at < ?', date.beginning_of_day, date.tomorrow.beginning_of_day]}}
3
+ default_scope { order('checkins.id DESC') }
4
+ scope :on, lambda {|date| where('created_at >= ? AND created_at < ?', date.beginning_of_day, date.tomorrow.beginning_of_day)}
5
5
  has_one :checkout
6
6
  belongs_to :item, touch: true
7
7
  belongs_to :librarian, class_name: 'User'
@@ -35,9 +35,11 @@ class Checkin < ActiveRecord::Base
35
35
  message = ''
36
36
  Checkin.transaction do
37
37
  item.checkin!
38
- Checkout.not_returned.where(item_id: item_id).select(
39
- [:id, :item_id, :user_id, :basket_id, :due_date, :lock_version, :created_at, :checkout_renewal_count]
40
- ).each do |checkout|
38
+ Checkout.not_returned.where(item_id: item_id).select([
39
+ :id, :item_id, :user_id, :librarian_id,
40
+ :basket_id, :due_date, :lock_version, :created_at,
41
+ :checkout_renewal_count
42
+ ]).each do |checkout|
41
43
  # TODO: ILL時の処理
42
44
  checkout.checkin = self
43
45
  checkout.operator = current_user
@@ -1,12 +1,12 @@
1
1
  class Checkout < ActiveRecord::Base
2
2
  attr_accessible :due_date
3
- default_scope order: 'checkouts.id DESC'
4
- scope :not_returned, where(:checkin_id => nil)
5
- scope :returned, where('checkin_id IS NOT NULL')
6
- scope :overdue, lambda {|date| {conditions: ['checkin_id IS NULL AND due_date < ?', date]}}
7
- scope :due_date_on, lambda {|date| where(:checkin_id => nil, :due_date => date.beginning_of_day .. date.end_of_day)}
8
- scope :completed, lambda {|start_date, end_date| {conditions: ['created_at >= ? AND created_at < ?', start_date, end_date]}}
9
- scope :on, lambda {|date| {conditions: ['created_at >= ? AND created_at < ?', date.beginning_of_day, date.tomorrow.beginning_of_day]}}
3
+ default_scope { order('checkouts.id DESC') }
4
+ scope :not_returned, -> { where(checkin_id: nil) }
5
+ scope :returned, -> { where('checkin_id IS NOT NULL') }
6
+ scope :overdue, lambda {|date| where('checkin_id IS NULL AND due_date < ?', date)}
7
+ scope :due_date_on, lambda {|date| where(checkin_id: nil, due_date: date.beginning_of_day .. date.end_of_day)}
8
+ scope :completed, lambda {|start_date, end_date| where('checkouts.created_at >= ? AND checkouts.created_at < ?', start_date, end_date)}
9
+ scope :on, lambda {|date| where('created_at >= ? AND created_at < ?', date.beginning_of_day, date.tomorrow.beginning_of_day)}
10
10
 
11
11
  belongs_to :user
12
12
  delegate :username, :user_number, :to => :user, :prefix => true
@@ -148,6 +148,10 @@ class Checkout < ActiveRecord::Base
148
148
  def self.remove_all_history(user)
149
149
  user.checkouts.returned.update_all(:user_id => nil)
150
150
  end
151
+
152
+ def self.calculate_item
153
+ joins(item: :shelf).group(:library_id).count(:id)
154
+ end
151
155
  end
152
156
 
153
157
  # == Schema Information
@@ -1,9 +1,9 @@
1
1
  class CheckoutType < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note
3
3
  include MasterModel
4
- default_scope order: "checkout_types.position"
5
- scope :available_for_carrier_type, lambda {|carrier_type| {:include => :carrier_types, conditions: ['carrier_types.name = ?', carrier_type.name], order: 'carrier_types.position'}}
6
- scope :available_for_user_group, lambda {|user_group| {:include => :user_groups, conditions: ['user_groups.name = ?', user_group.name], order: 'user_group.position'}}
4
+ default_scope { order('checkout_types.position') }
5
+ scope :available_for_carrier_type, lambda {|carrier_type| includes(:carrier_types).where('carrier_types.name = ?', carrier_type.name).order('carrier_types.position')}
6
+ scope :available_for_user_group, lambda {|user_group| includes(:user_groups).where('user_groups.name = ?', user_group.name).order('user_group.position')}
7
7
 
8
8
  has_many :user_group_has_checkout_types, dependent: :destroy
9
9
  has_many :user_groups, through: :user_group_has_checkout_types
@@ -1,14 +1,15 @@
1
1
  class CirculationStatus < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note
3
3
  include MasterModel
4
- validates :name, presence: true, format: {with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/}
4
+ validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }
5
5
 
6
- default_scope order: "circulation_statuses.position"
7
- scope :available_for_checkout, where(name: 'Available On Shelf')
6
+ default_scope { order('circulation_statuses.position') }
7
+ scope :available_for_checkout, -> { where(name: 'Available On Shelf') }
8
8
  has_many :items
9
9
 
10
- def set_display_name
11
- self.display_name = "#{I18n.locale}: #{name}" if display_name.blank?
10
+ private
11
+ def valid_name?
12
+ true
12
13
  end
13
14
  end
14
15
 
@@ -1,5 +1,5 @@
1
1
  class ItemHasUseRestriction < ActiveRecord::Base
2
- attr_accessible :item_id, :use_restriction_id
2
+ attr_accessible :item_id, :use_restriction_id, :use_restriction
3
3
  belongs_to :item, validate: true
4
4
  belongs_to :use_restriction, validate: true
5
5
  accepts_nested_attributes_for :use_restriction
@@ -1,7 +1,7 @@
1
1
  class LendingPolicy < ActiveRecord::Base
2
2
  attr_accessible :item_id, :user_group_id, :loan_period, :fixed_due_date,
3
3
  :renewal, :fine, :note, :position
4
- default_scope order: 'lending_policies.position'
4
+ default_scope { order('lending_policies.position') }
5
5
  belongs_to :item
6
6
  belongs_to :user_group
7
7
 
@@ -27,7 +27,7 @@ class ManifestationCheckoutStat < ActiveRecord::Base
27
27
  #manifestation.update_attributes({:daily_checkouts_count => daily_count, :total_count => manifestation.total_count + daily_count})
28
28
  if daily_count > 0
29
29
  self.manifestations << manifestation
30
- sql = ['UPDATE checkout_stat_has_manifestations SET checkouts_count = ? WHERE manifestation_checkout_stat_id = ? AND manifestation_id = ?', daily_count, self.id, manifestation.id]
30
+ sql = ['UPDATE checkout_stat_has_manifestations SET checkouts_count = ? WHERE manifestation_checkout_stat_id = ? AND manifestation_id = ?', daily_count, id, manifestation.id]
31
31
  ManifestationCheckoutStat.connection.execute(
32
32
  self.class.send(:sanitize_sql_array, sql)
33
33
  )
@@ -27,7 +27,7 @@ class ManifestationReserveStat < ActiveRecord::Base
27
27
  #manifestation.update_attributes({:daily_reserves_count => daily_count, :total_count => manifestation.total_count + daily_count})
28
28
  if daily_count > 0
29
29
  self.manifestations << manifestation
30
- sql = ['UPDATE reserve_stat_has_manifestations SET reserves_count = ? WHERE manifestation_reserve_stat_id = ? AND manifestation_id = ?', daily_count, self.id, manifestation.id]
30
+ sql = ['UPDATE reserve_stat_has_manifestations SET reserves_count = ? WHERE manifestation_reserve_stat_id = ? AND manifestation_id = ?', daily_count, id, manifestation.id]
31
31
  ManifestationReserveStat.connection.execute(
32
32
  self.class.send(:sanitize_sql_array, sql)
33
33
  )
@@ -8,8 +8,8 @@ class Reserve < ActiveRecord::Base
8
8
  :expiration_notice_to_patron, :expiration_notice_to_library, :item_id,
9
9
  :retained_at, :postponed_at, :force_retaining,
10
10
  as: :admin
11
- scope :hold, where('item_id IS NOT NULL')
12
- scope :not_hold, where(item_id: nil)
11
+ scope :hold, -> { where('item_id IS NOT NULL') }
12
+ scope :not_hold, -> { where(item_id: nil) }
13
13
  scope :waiting, -> {not_in_state(:completed, :expired).where('canceled_at IS NULL AND expired_at > ?', Time.zone.now).order('reserves.id DESC')}
14
14
  scope :retained, -> {in_state(:retained).where('retained_at IS NOT NULL')}
15
15
  scope :completed, -> {in_state(:completed).where('checked_out_at IS NOT NULL')}
@@ -17,7 +17,7 @@ class Reserve < ActiveRecord::Base
17
17
  scope :postponed, -> {in_state(:postponed).where('postponed_at IS NOT NULL')}
18
18
  scope :will_expire_retained, lambda {|datetime| in_state(:retained).where('checked_out_at IS NULL AND canceled_at IS NULL AND expired_at <= ?', datetime).order('expired_at')}
19
19
  scope :will_expire_pending, lambda {|datetime| in_state(:pending).where('checked_out_at IS NULL AND canceled_at IS NULL AND expired_at <= ?', datetime).order('expired_at')}
20
- scope :created, lambda {|start_date, end_date| {conditions: ['created_at >= ? AND created_at < ?', start_date, end_date]}}
20
+ scope :created, lambda {|start_date, end_date| where('created_at >= ? AND created_at < ?', start_date, end_date)}
21
21
  scope :not_sent_expiration_notice_to_patron, -> {in_state(:expired).where(:expiration_notice_to_patron => false)}
22
22
  scope :not_sent_expiration_notice_to_library, -> {in_state(:expired).where(:expiration_notice_to_library => false)}
23
23
  scope :sent_expiration_notice_to_patron, -> {in_state(:expired).where(:expiration_notice_to_patron => true)}
@@ -31,31 +31,31 @@ class Reserve < ActiveRecord::Base
31
31
  belongs_to :request_status_type
32
32
 
33
33
  validates_associated :user, :librarian, :request_status_type
34
- validates :manifestation, :associated => true #, on: :create
34
+ validates :manifestation, associated: true #, on: :create
35
35
  validates_presence_of :user, :request_status_type
36
- validates :manifestation, presence: true, :unless => Proc.new{|reserve|
36
+ validates :manifestation, presence: true, unless: Proc.new{|reserve|
37
37
  reserve.completed?
38
38
  }
39
39
  #validates_uniqueness_of :manifestation_id, scope: :user_id
40
40
  validates_date :expired_at, allow_blank: true
41
41
  validate :manifestation_must_include_item
42
42
  validate :available_for_reservation?, on: :create
43
- validates :item_id, presence: true, :if => Proc.new{|reserve|
43
+ validates :item_id, presence: true, if: Proc.new{|reserve|
44
44
  if item_id_changed?
45
45
  if reserve.completed? or reserve.retained?
46
46
  unless item_id_change[0]
47
- return false
47
+ false
48
48
  else
49
49
  unless item_id_change[1]
50
- return false
50
+ false
51
51
  else
52
- return true
52
+ true
53
53
  end
54
54
  end
55
55
  end
56
56
  else
57
57
  if reserve.retained?
58
- return true
58
+ true
59
59
  end
60
60
  end
61
61
  }
@@ -163,7 +163,7 @@ class Reserve < ActiveRecord::Base
163
163
 
164
164
  def next_reservation
165
165
  if item
166
- Reserve.waiting.where(:manifestation_id => item.manifestation.id).readonly(false).first
166
+ Reserve.waiting.where(manifestation_id: item.manifestation.id).readonly(false).first
167
167
  end
168
168
  end
169
169
 
@@ -317,13 +317,13 @@ class Reserve < ActiveRecord::Base
317
317
 
318
318
  private
319
319
  def do_request
320
- self.assign_attributes({:request_status_type => RequestStatusType.where(name: 'In Process').first, item_id: nil, :retained_at => nil}, as: :admin)
320
+ self.assign_attributes({request_status_type: RequestStatusType.where(name: 'In Process').first, item_id: nil, retained_at: nil}, as: :admin)
321
321
  save!
322
322
  end
323
323
 
324
324
  def retain
325
325
  # TODO: 「取り置き中」の状態を正しく表す
326
- self.assign_attributes({:request_status_type => RequestStatusType.where(name: 'In Process').first, :retained_at => Time.zone.now}, as: :admin)
326
+ self.assign_attributes({request_status_type: RequestStatusType.where(name: 'In Process').first, retained_at: Time.zone.now}, as: :admin)
327
327
  Reserve.transaction do
328
328
  if item.try(:next_reservation)
329
329
  reservation = item.next_reservation
@@ -335,7 +335,7 @@ class Reserve < ActiveRecord::Base
335
335
 
336
336
  def expire
337
337
  Reserve.transaction do
338
- self.assign_attributes({:request_status_type => RequestStatusType.where(name: 'Expired').first, :canceled_at => Time.zone.now}, as: :admin)
338
+ self.assign_attributes({request_status_type: RequestStatusType.where(name: 'Expired').first, canceled_at: Time.zone.now}, as: :admin)
339
339
  reserve = next_reservation
340
340
  if reserve
341
341
  reserve.item = item
@@ -349,7 +349,7 @@ class Reserve < ActiveRecord::Base
349
349
 
350
350
  def cancel
351
351
  Reserve.transaction do
352
- self.assign_attributes({:request_status_type => RequestStatusType.where(name: 'Cannot Fulfill Request').first, :canceled_at => Time.zone.now}, as: :admin)
352
+ self.assign_attributes({request_status_type: RequestStatusType.where(name: 'Cannot Fulfill Request').first, canceled_at: Time.zone.now}, as: :admin)
353
353
  save!
354
354
  reserve = next_reservation
355
355
  if reserve
@@ -362,16 +362,16 @@ class Reserve < ActiveRecord::Base
362
362
  end
363
363
 
364
364
  def checkout
365
- self.assign_attributes({:request_status_type => RequestStatusType.where(name: 'Available For Pickup').first, :checked_out_at => Time.zone.now}, as: :admin)
365
+ self.assign_attributes({request_status_type: RequestStatusType.where(name: 'Available For Pickup').first, checked_out_at: Time.zone.now}, as: :admin)
366
366
  save!
367
367
  end
368
368
 
369
369
  def postpone
370
370
  self.assign_attributes({
371
- :request_status_type => RequestStatusType.where(name: 'In Process').first,
371
+ request_status_type: RequestStatusType.where(name: 'In Process').first,
372
372
  item_id: nil,
373
- :retained_at => nil,
374
- :postponed_at => Time.zone.now
373
+ retained_at: nil,
374
+ postponed_at: Time.zone.now
375
375
  }, as: :admin)
376
376
  save!
377
377
  end
@@ -1,15 +1,16 @@
1
1
  class UseRestriction < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note
3
3
  include MasterModel
4
- validates :name, presence: true, format: {with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/}
4
+ validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }
5
5
 
6
- default_scope {order('use_restrictions.position')}
6
+ default_scope { order('use_restrictions.position') }
7
7
  scope :available, -> {where(name: ['Not For Loan', 'Limited Circulation, Normal Loan Period'])}
8
8
  has_many :item_has_use_restrictions
9
9
  has_many :items, through: :item_has_use_restrictions
10
10
 
11
- def set_display_name
12
- self.display_name = "#{I18n.locale}: #{name}" if display_name.blank?
11
+ private
12
+ def valid_name?
13
+ true
13
14
  end
14
15
  end
15
16
 
@@ -5,7 +5,7 @@ class UserGroupHasCheckoutType < ActiveRecord::Base
5
5
  :set_due_date_before_closing_day, :fixed_due_date, :note, :position,
6
6
  :user_group, :checkout_type
7
7
  scope :available_for_item, lambda{|item| where(:checkout_type_id => item.checkout_type.id)}
8
- scope :available_for_carrier_type, lambda{|carrier_type| {:include => {:checkout_type => :carrier_types}, conditions: ['carrier_types.id = ?', carrier_type.id]}}
8
+ scope :available_for_carrier_type, lambda{|carrier_type| includes(:checkout_type => :carrier_types).where('carrier_types.id' => carrier_type.id)}
9
9
 
10
10
  belongs_to :user_group, validate: true
11
11
  belongs_to :checkout_type, validate: true
@@ -15,7 +15,7 @@
15
15
  <li><%= link_to @basket.user.username, @basket.user.profile -%></li>
16
16
  </ul>
17
17
  <ul>
18
- <%- @basket.user.user_group.user_group_has_checkout_types.each do |available_checkout_type| -%>
18
+ <%- @basket.user.profile.user_group.user_group_has_checkout_types.each do |available_checkout_type| -%>
19
19
  <li>
20
20
  <%= available_checkout_type.checkout_type.display_name.localize -%>:
21
21
  <%= @basket.user.checked_item_count[:"#{available_checkout_type.checkout_type.name}"] -%> / <%= available_checkout_type.checkout_limit -%>
@@ -13,7 +13,7 @@
13
13
 
14
14
  <div id="submenu" class="ui-corner-all ui-widget-content">
15
15
  <ul>
16
- <%- user.user_group.user_group_has_checkout_types.each do |available_checkout_type| -%>
16
+ <%- user.profile.user_group.user_group_has_checkout_types.each do |available_checkout_type| -%>
17
17
  <li>
18
18
  <%= available_checkout_type.checkout_type.display_name.localize -%>:
19
19
  <%= user.checked_item_count[:"#{available_checkout_type.checkout_type.name}"] -%> / <%= available_checkout_type.checkout_limit -%>
@@ -18,6 +18,15 @@
18
18
  <%= localized_state(@manifestation_checkout_stat.current_state) -%>
19
19
  </p>
20
20
 
21
+ <p>
22
+ <strong><%= t('statistic.breakdown') -%>:</strong>
23
+ <ul>
24
+ <% @breakdown.each do |k, v| %>
25
+ <li><%= CarrierType.find(k).display_name.localize %>: <%= v %></li>
26
+ <% end %>
27
+ </ul>
28
+ </p>
29
+
21
30
  <p>
22
31
  <strong><%= t('activerecord.attributes.manifestation_checkout_stat.note') -%>:</strong>
23
32
  <%= @manifestation_checkout_stat.note -%>
@@ -1,4 +1,5 @@
1
- <%= @manifestation_checkout_stat.start_date -%> <%= @manifestation_checkout_stat.end_date %>
1
+ <%= @manifestation_checkout_stat.start_date -%><%= "\t" %><%= @manifestation_checkout_stat.end_date %>
2
+ manifestation_id<%= "\t" %>title<%= "\t" %>carrier_type<%= "\t" %>count
2
3
  <%- @stats.each do |stat| -%>
3
- "<%= stat.manifestation.original_title if stat.manifestation -%>" "<%=h stat.checkouts_count -%>"<%= "\n" -%>
4
+ <%= stat.manifestation.id if stat.manifestation %><%= "\t" %><%= stat.manifestation.original_title if stat.manifestation -%><%= "\t" %><%= stat.manifestation.carrier_type.name %><%= "\t" %><%= stat.checkouts_count -%><%= "\n" %>
4
5
  <%- end -%>
@@ -1,4 +1,5 @@
1
- <%= @manifestation_reserve_stat.start_date -%> <%= @manifestation_reserve_stat.end_date %>
1
+ <%= @manifestation_reserve_stat.start_date -%><%= "\t" %><%= @manifestation_reserve_stat.end_date %>
2
+ title<%= "\t" %>carrier_type<%= "\t" %>count
2
3
  <%- @stats.each do |stat| -%>
3
- "<%= stat.manifestation.original_title if stat.manifestation -%>" "<%=h stat.reserves_count -%>"<%= "\n" -%>
4
+ <%= stat.manifestation.id if stat.manifestation %><%= "\t" %><%= stat.manifestation.original_title if stat.manifestation -%><%= "\t" %><%= stat.manifestation.carrier_type.name %><%= "\t" %><%= stat.reserves_count -%><%= "\n" %>
4
5
  <%- end -%>
@@ -194,3 +194,4 @@ en:
194
194
  start_counting: "Start counting"
195
195
  statistic:
196
196
  successfully_created: "%{model} task was created successfully. When the task is completed, its status on the list will be updated to 'completed' and you can check the results by following the 'show' link."
197
+ breakdown: Brakedown
@@ -192,3 +192,4 @@ ja:
192
192
  start_counting: "集計を開始"
193
193
  statistic:
194
194
  successfully_created: "%{model}のタスクは正常に作成されました。タスクが完了すると「%{model}の一覧」の状態が「完了」となり、「表示」リンクをたどることで結果を確認できるようになります。"
195
+ breakdown: 内訳
@@ -27,11 +27,11 @@ module EnjuCirculation
27
27
  include InstanceMethods
28
28
  has_many :reserves, :foreign_key => :manifestation_id
29
29
 
30
- scope :for_checkout, includes(:circulation_status, :use_restriction).where(
30
+ scope :for_checkout, -> { includes(:circulation_status, :use_restriction).where(
31
31
  'circulation_statuses.name' => FOR_CHECKOUT_CIRCULATION_STATUS,
32
32
  'use_restrictions.name' => FOR_CHECKOUT_USE_RESTRICTION
33
- ).where('item_identifier IS NOT NULL')
34
- scope :removed, includes(:circulation_status).where('circulation_statuses.name' => 'Removed')
33
+ ).where('item_identifier IS NOT NULL') }
34
+ scope :removed, -> { includes(:circulation_status).where('circulation_statuses.name' => 'Removed') }
35
35
  has_many :checkouts
36
36
  has_many :reserves
37
37
  has_many :checked_items
@@ -6,8 +6,8 @@ module EnjuCirculation
6
6
 
7
7
  module ClassMethods
8
8
  def enju_circulation_user_group_model
9
- has_many :user_group_has_checkout_types, :dependent => :destroy
10
- has_many :checkout_types, :through => :user_group_has_checkout_types, :order => :position
9
+ has_many :user_group_has_checkout_types, dependent: :destroy
10
+ has_many :checkout_types, through: :user_group_has_checkout_types
11
11
  has_many :lending_policies
12
12
  attr_accessible :user_group_has_checkout_types_attributes
13
13
  accepts_nested_attributes_for :user_group_has_checkout_types, :allow_destroy => true, :reject_if => :all_blank
@@ -1,3 +1,3 @@
1
1
  module EnjuCirculation
2
- VERSION = "0.1.0.pre38"
2
+ VERSION = "0.1.0.pre39"
3
3
  end
@@ -13,7 +13,7 @@ describe CheckoutTypesController do
13
13
 
14
14
  it "assigns all checkout_types as @checkout_types" do
15
15
  get :index
16
- assigns(:checkout_types).should eq(CheckoutType.all)
16
+ assigns(:checkout_types).should eq(CheckoutType.order(:position))
17
17
  end
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ describe CheckoutTypesController do
22
22
 
23
23
  it "assigns all checkout_types as @checkout_types" do
24
24
  get :index
25
- assigns(:checkout_types).should eq(CheckoutType.all)
25
+ assigns(:checkout_types).should eq(CheckoutType.order(:position))
26
26
  end
27
27
  end
28
28
 
@@ -19,7 +19,7 @@ describe CirculationStatusesController do
19
19
 
20
20
  it "assigns all circulation_statuses as @circulation_statuses" do
21
21
  get :index
22
- assigns(:circulation_statuses).should eq(CirculationStatus.all)
22
+ assigns(:circulation_statuses).should eq(CirculationStatus.order(:position))
23
23
  end
24
24
  end
25
25
 
@@ -28,7 +28,7 @@ describe CirculationStatusesController do
28
28
 
29
29
  it "assigns all circulation_statuses as @circulation_statuses" do
30
30
  get :index
31
- assigns(:circulation_statuses).should eq(CirculationStatus.all)
31
+ assigns(:circulation_statuses).should eq(CirculationStatus.order(:position))
32
32
  end
33
33
  end
34
34
 
@@ -37,14 +37,14 @@ describe CirculationStatusesController do
37
37
 
38
38
  it "assigns all circulation_statuses as @circulation_statuses" do
39
39
  get :index
40
- assigns(:circulation_statuses).should eq(CirculationStatus.all)
40
+ assigns(:circulation_statuses).should eq(CirculationStatus.order(:position))
41
41
  end
42
42
  end
43
43
 
44
44
  describe "When not logged in" do
45
45
  it "assigns all circulation_statuses as @circulation_statuses" do
46
46
  get :index
47
- assigns(:circulation_statuses).should eq(CirculationStatus.all)
47
+ assigns(:circulation_statuses).should eq(CirculationStatus.order(:position))
48
48
  end
49
49
  end
50
50
  end
@@ -19,7 +19,7 @@ describe ItemHasUseRestrictionsController do
19
19
 
20
20
  it "assigns all item_has_use_restrictions as @item_has_use_restrictions" do
21
21
  get :index
22
- assigns(:item_has_use_restrictions).should eq(ItemHasUseRestriction.all(:order => 'id DESC'))
22
+ assigns(:item_has_use_restrictions).should eq(ItemHasUseRestriction.order('id DESC').page(1))
23
23
  end
24
24
  end
25
25
 
@@ -28,7 +28,7 @@ describe ItemHasUseRestrictionsController do
28
28
 
29
29
  it "assigns all item_has_use_restrictions as @item_has_use_restrictions" do
30
30
  get :index
31
- assigns(:item_has_use_restrictions).should eq(ItemHasUseRestriction.all(:order => 'id DESC'))
31
+ assigns(:item_has_use_restrictions).should eq(ItemHasUseRestriction.order('id DESC').page(1))
32
32
  end
33
33
  end
34
34
 
@@ -13,7 +13,7 @@ describe ManifestationCheckoutStatsController do
13
13
 
14
14
  it "assigns all manifestation_checkout_stats as @manifestation_checkout_stats" do
15
15
  get :index
16
- assigns(:manifestation_checkout_stats).should eq(ManifestationCheckoutStat.all)
16
+ assigns(:manifestation_checkout_stats).should eq(ManifestationCheckoutStat.page(1))
17
17
  end
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ describe ManifestationCheckoutStatsController do
22
22
 
23
23
  it "assigns all manifestation_checkout_stats as @manifestation_checkout_stats" do
24
24
  get :index
25
- assigns(:manifestation_checkout_stats).should eq(ManifestationCheckoutStat.all)
25
+ assigns(:manifestation_checkout_stats).should eq(ManifestationCheckoutStat.page(1))
26
26
  end
27
27
  end
28
28
 
@@ -31,14 +31,14 @@ describe ManifestationCheckoutStatsController do
31
31
 
32
32
  it "assigns all manifestation_checkout_stats as @manifestation_checkout_stats" do
33
33
  get :index
34
- assigns(:manifestation_checkout_stats).should eq(ManifestationCheckoutStat.all)
34
+ assigns(:manifestation_checkout_stats).should eq(ManifestationCheckoutStat.page(1))
35
35
  end
36
36
  end
37
37
 
38
38
  describe "When not logged in" do
39
39
  it "should not assign manifestation_checkout_stats as @manifestation_checkout_stats" do
40
40
  get :index
41
- assigns(:manifestation_checkout_stats).should eq(ManifestationCheckoutStat.all)
41
+ assigns(:manifestation_checkout_stats).should eq(ManifestationCheckoutStat.page(1))
42
42
  end
43
43
  end
44
44
  end
@@ -13,7 +13,7 @@ describe ManifestationReserveStatsController do
13
13
 
14
14
  it "assigns all manifestation_reserve_stats as @manifestation_reserve_stats" do
15
15
  get :index
16
- assigns(:manifestation_reserve_stats).should eq(ManifestationReserveStat.all)
16
+ assigns(:manifestation_reserve_stats).should eq(ManifestationReserveStat.page(1))
17
17
  end
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ describe ManifestationReserveStatsController do
22
22
 
23
23
  it "assigns all manifestation_reserve_stats as @manifestation_reserve_stats" do
24
24
  get :index
25
- assigns(:manifestation_reserve_stats).should eq(ManifestationReserveStat.all)
25
+ assigns(:manifestation_reserve_stats).should eq(ManifestationReserveStat.page(1))
26
26
  end
27
27
  end
28
28
 
@@ -31,14 +31,14 @@ describe ManifestationReserveStatsController do
31
31
 
32
32
  it "assigns all manifestation_reserve_stats as @manifestation_reserve_stats" do
33
33
  get :index
34
- assigns(:manifestation_reserve_stats).should eq(ManifestationReserveStat.all)
34
+ assigns(:manifestation_reserve_stats).should eq(ManifestationReserveStat.page(1))
35
35
  end
36
36
  end
37
37
 
38
38
  describe "When not logged in" do
39
39
  it "should not assign manifestation_reserve_stats as @manifestation_reserve_stats" do
40
40
  get :index
41
- assigns(:manifestation_reserve_stats).should eq(ManifestationReserveStat.all)
41
+ assigns(:manifestation_reserve_stats).should eq(ManifestationReserveStat.page(1))
42
42
  end
43
43
  end
44
44
  end
@@ -19,7 +19,7 @@ describe UseRestrictionsController do
19
19
 
20
20
  it "assigns all use_restrictions as @use_restrictions" do
21
21
  get :index
22
- assigns(:use_restrictions).should eq(UseRestriction.all)
22
+ assigns(:use_restrictions).should eq(UseRestriction.order(:position))
23
23
  end
24
24
  end
25
25
 
@@ -28,7 +28,7 @@ describe UseRestrictionsController do
28
28
 
29
29
  it "assigns all use_restrictions as @use_restrictions" do
30
30
  get :index
31
- assigns(:use_restrictions).should eq(UseRestriction.all)
31
+ assigns(:use_restrictions).should eq(UseRestriction.order(:position))
32
32
  end
33
33
  end
34
34
 
@@ -13,7 +13,7 @@ describe UserCheckoutStatsController do
13
13
 
14
14
  it "assigns all user_checkout_stats as @user_checkout_stats" do
15
15
  get :index
16
- assigns(:user_checkout_stats).should eq(UserCheckoutStat.all)
16
+ assigns(:user_checkout_stats).should eq(UserCheckoutStat.order('id DESC').page(1))
17
17
  end
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ describe UserCheckoutStatsController do
22
22
 
23
23
  it "assigns all user_checkout_stats as @user_checkout_stats" do
24
24
  get :index
25
- assigns(:user_checkout_stats).should eq(UserCheckoutStat.all)
25
+ assigns(:user_checkout_stats).should eq(UserCheckoutStat.order('id DESC').page(1))
26
26
  end
27
27
  end
28
28
 
@@ -31,14 +31,14 @@ describe UserCheckoutStatsController do
31
31
 
32
32
  it "assigns all user_checkout_stats as @user_checkout_stats" do
33
33
  get :index
34
- assigns(:user_checkout_stats).should eq(UserCheckoutStat.all)
34
+ assigns(:user_checkout_stats).should eq(UserCheckoutStat.order('id DESC').page(1))
35
35
  end
36
36
  end
37
37
 
38
38
  describe "When not logged in" do
39
39
  it "should not assign user_checkout_stats as @user_checkout_stats" do
40
40
  get :index
41
- assigns(:user_checkout_stats).should eq(UserCheckoutStat.all)
41
+ assigns(:user_checkout_stats).should eq(UserCheckoutStat.order('id DESC').page(1))
42
42
  end
43
43
  end
44
44
  end