sufia-models 6.1.0 → 6.2.0

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
  SHA1:
3
- metadata.gz: 88115b1a7a645491dcff7e47680ae4f2f4699d5f
4
- data.tar.gz: c6348bf5e986f9b0666b5f8c3494fc8c864e74ae
3
+ metadata.gz: f5e3ced04ed7546efd8a437f75c39d33bd25ef49
4
+ data.tar.gz: beb42fc315b7a71f58a87f00492940f0ba57263d
5
5
  SHA512:
6
- metadata.gz: 43f9323fcfa7cd7d73ce861dcb42c4fd2df22f7b09c3975d4fe18a654a66d39a49c07990399ef97106cfe4c9738420faafec1f0f7b3ef8c0281da8277204e3b9
7
- data.tar.gz: bab9cc33d1e179f8b6e590429710d328c2571626a56dd4884e37ce0deb883ec2327cee36d502291f1a9c3f80d9342b1d6833eabb1a666140af81616edbbb67db
6
+ metadata.gz: 3b35bd03100ce61e5d87660b5f10cf7fa0591642859fea090423d170b99af71cea155b4b46f4fd6014c3b98a80e918e5f6cfb64fd86c23579f3ab3629a6fd675
7
+ data.tar.gz: dbe7e42f40291485bdb85fa8bb241d0115a29819da55d9155229f0a45b5359f65cc2178e9c7c83c27311657521a8ea6f974eee7a3b5e70e2b5315c853f2965c9
@@ -21,5 +21,6 @@ module Sufia
21
21
  include Hydra::Collections::Collectible
22
22
  include Sufia::GenericFile::Batches
23
23
  include Sufia::GenericFile::Indexing
24
+ include Sufia::GenericFile::Querying
24
25
  end
25
26
  end
@@ -0,0 +1,43 @@
1
+ module Sufia
2
+ module GenericFile
3
+ module Querying
4
+ extend ActiveSupport::Concern
5
+
6
+ module ClassMethods
7
+ # query to find generic files created during the time range
8
+ # @param [DateTime] start_datetime starting date time for range query
9
+ # @param [DateTime] end_datetime ending date time for range query
10
+ def find_by_date_created(start_datetime, end_datetime=nil)
11
+ return [] if start_datetime.blank? # no date just return nothing
12
+ start_date_str = start_datetime.utc.strftime(self.date_format)
13
+ end_date_str = if end_datetime.blank?
14
+ "*"
15
+ else
16
+ end_datetime.utc.strftime(self.date_format)
17
+ end
18
+ where "system_create_dtsi:[#{start_date_str} TO #{end_date_str}]"
19
+ end
20
+
21
+ def where_private
22
+ where_access_is 'private'
23
+ end
24
+
25
+ def where_public
26
+ where_access_is 'public'
27
+ end
28
+
29
+ def where_registered
30
+ where_access_is 'registered'
31
+ end
32
+
33
+ def where_access_is(access_level)
34
+ where Solrizer.solr_name('read_access_group', :symbol) => access_level
35
+ end
36
+
37
+ def date_format
38
+ "%Y-%m-%dT%H:%M:%SZ"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -167,5 +167,10 @@ module Sufia::User
167
167
  def from_url_component(component)
168
168
  User.find_by_user_key(component.gsub(/-dot-/, '.'))
169
169
  end
170
+
171
+ def recent_users(start_date, end_date = nil)
172
+ end_date ||= DateTime.now # doing or eq here so that if the user passes nil we still get now
173
+ return User.where(created_at: start_date..end_date)
174
+ end
170
175
  end
171
176
  end
@@ -42,7 +42,7 @@ module Sufia
42
42
  ::User.find_each do |user|
43
43
  users.push(UserRecord.new(user.id, user.user_key, date_since_last_cache(user)))
44
44
  end
45
- users.sort! {|a, b| a.last_stats_update <=> b.last_stats_update}
45
+ users.sort {|a, b| a.last_stats_update <=> b.last_stats_update}
46
46
  end
47
47
 
48
48
  private
@@ -1,5 +1,5 @@
1
1
  module Sufia
2
2
  module Models
3
- VERSION = "6.1.0"
3
+ VERSION = "6.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sufia-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-02 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -348,6 +348,7 @@ files:
348
348
  - app/models/concerns/sufia/generic_file/mime_types.rb
349
349
  - app/models/concerns/sufia/generic_file/permissions.rb
350
350
  - app/models/concerns/sufia/generic_file/proxy_deposit.rb
351
+ - app/models/concerns/sufia/generic_file/querying.rb
351
352
  - app/models/concerns/sufia/generic_file/trophies.rb
352
353
  - app/models/concerns/sufia/generic_file/versions.rb
353
354
  - app/models/concerns/sufia/generic_file/virus_check.rb
@@ -481,7 +482,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
481
482
  version: '0'
482
483
  requirements: []
483
484
  rubyforge_project:
484
- rubygems_version: 2.4.5
485
+ rubygems_version: 2.4.6
485
486
  signing_key:
486
487
  specification_version: 4
487
488
  summary: Models and services for sufia