enju_circulation 0.0.64 → 0.0.65
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/checkout.rb +2 -1
- data/app/views/checkouts/_index_user.html.erb +1 -1
- data/lib/enju_circulation/version.rb +1 -1
- data/spec/controllers/checkouts_controller_spec.rb +6 -6
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/segments_1 +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- data/spec/models/checkout_spec.rb +1 -1
- metadata +2 -2
data/app/models/checkout.rb
CHANGED
@@ -2,6 +2,7 @@ class Checkout < ActiveRecord::Base
|
|
2
2
|
attr_accessible :due_date
|
3
3
|
default_scope :order => 'checkouts.id DESC'
|
4
4
|
scope :not_returned, where(:checkin_id => nil)
|
5
|
+
scope :returned, where('checkin_id IS NOT NULL')
|
5
6
|
scope :overdue, lambda {|date| {:conditions => ['checkin_id IS NULL AND due_date < ?', date]}}
|
6
7
|
scope :due_date_on, lambda {|date| where(:checkin_id => nil, :due_date => date.beginning_of_day .. date.end_of_day)}
|
7
8
|
scope :completed, lambda {|start_date, end_date| {:conditions => ['created_at >= ? AND created_at < ?', start_date, end_date]}}
|
@@ -108,7 +109,7 @@ class Checkout < ActiveRecord::Base
|
|
108
109
|
end
|
109
110
|
|
110
111
|
def self.remove_all_history(user)
|
111
|
-
user.checkouts.update_all(:user_id => nil)
|
112
|
+
user.checkouts.returned.update_all(:user_id => nil)
|
112
113
|
end
|
113
114
|
end
|
114
115
|
# == Schema Information
|
@@ -53,7 +53,7 @@
|
|
53
53
|
</ul>
|
54
54
|
<ul>
|
55
55
|
<% if @user == current_user %>
|
56
|
-
<li><%= link_to t('checkout.remove_all_history'), remove_all_user_checkouts_path(current_user), :method => :put %></li>
|
56
|
+
<li><%= link_to t('checkout.remove_all_history'), remove_all_user_checkouts_path(current_user), :method => :put, :data => {:confirm => t('page.are_you_sure')} %></li>
|
57
57
|
<% end %>
|
58
58
|
</ul>
|
59
59
|
</div>
|
@@ -276,13 +276,13 @@ describe CheckoutsController do
|
|
276
276
|
|
277
277
|
it "should remove its own checkout history" do
|
278
278
|
put :remove_all, :user_id => users(:user1).username
|
279
|
-
users(:user1).checkouts.count.should eq 0
|
279
|
+
users(:user1).checkouts.returned.count.should eq 0
|
280
280
|
response.should redirect_to checkouts_url
|
281
281
|
end
|
282
282
|
|
283
283
|
it "should not remove other checkout history" do
|
284
284
|
put :remove_all, :user_id => users(:user2).username
|
285
|
-
users(:user1).checkouts.count.should_not eq 0
|
285
|
+
users(:user1).checkouts.returned.count.should_not eq 0
|
286
286
|
response.should redirect_to checkouts_url
|
287
287
|
end
|
288
288
|
end
|
@@ -327,13 +327,13 @@ describe CheckoutsController do
|
|
327
327
|
|
328
328
|
it "should remove its own checkout history" do
|
329
329
|
put :remove_all, :user_id => users(:user1).username
|
330
|
-
users(:user1).checkouts.count.should eq 0
|
330
|
+
users(:user1).checkouts.returned.count.should eq 0
|
331
331
|
response.should redirect_to checkouts_url
|
332
332
|
end
|
333
333
|
|
334
334
|
it "should not remove other checkout history" do
|
335
335
|
put :remove_all, :user_id => users(:user2).username
|
336
|
-
users(:user1).checkouts.count.should_not eq 0
|
336
|
+
users(:user1).checkouts.returned.count.should_not eq 0
|
337
337
|
response.should redirect_to checkouts_url
|
338
338
|
end
|
339
339
|
end
|
@@ -386,13 +386,13 @@ describe CheckoutsController do
|
|
386
386
|
|
387
387
|
it "should remove its own checkout history" do
|
388
388
|
put :remove_all, :user_id => users(:user1).username
|
389
|
-
assigns(:user).checkouts.count.should eq 0
|
389
|
+
assigns(:user).checkouts.returned.count.should eq 0
|
390
390
|
response.should redirect_to checkouts_url
|
391
391
|
end
|
392
392
|
|
393
393
|
it "should not remove other checkout history" do
|
394
394
|
put :remove_all, :user_id => users(:admin).username
|
395
|
-
assigns(:user).checkouts.count.
|
395
|
+
assigns(:user).checkouts.returned.count.should eq 0
|
396
396
|
response.should be_forbidden
|
397
397
|
end
|
398
398
|
end
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_circulation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.65
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|