sufia 7.0.0.beta1 → 7.0.0.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/sufia.js +3 -4
  3. data/app/assets/stylesheets/sufia/_styles.scss +2 -1
  4. data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +1 -0
  5. data/app/controllers/errors_controller.rb +1 -1
  6. data/app/indexers/sufia/work_indexer.rb +1 -0
  7. data/app/presenters/sufia/admin_stats_presenter.rb +17 -11
  8. data/app/search_builders/sufia/catalog_search_builder.rb +29 -0
  9. data/app/search_builders/sufia/my_collections_search_builder.rb +7 -0
  10. data/app/search_builders/sufia/my_highlights_search_builder.rb +9 -3
  11. data/app/search_builders/sufia/my_shares_search_builder.rb +8 -1
  12. data/app/search_builders/sufia/search_builder.rb +0 -59
  13. data/app/services/sufia/analytics.rb +25 -8
  14. data/app/services/sufia/query_service.rb +1 -1
  15. data/app/services/sufia/statistics/collections/over_time.rb +13 -0
  16. data/app/services/sufia/statistics/depositors/summary.rb +54 -0
  17. data/app/services/sufia/statistics/file_sets/by_format.rb +14 -0
  18. data/app/services/sufia/statistics/over_time.rb +11 -3
  19. data/app/services/sufia/statistics/system_stats.rb +61 -0
  20. data/app/services/sufia/statistics/term_query.rb +65 -0
  21. data/app/services/sufia/statistics/works/by_depositor.rb +13 -0
  22. data/app/services/sufia/statistics/works/by_resource_type.rb +13 -0
  23. data/app/services/sufia/statistics/works/count.rb +49 -0
  24. data/app/services/sufia/statistics/works/over_time.rb +13 -0
  25. data/app/views/admin/stats/_stats_by_date.html.erb +1 -1
  26. data/app/views/admin/stats/_top_data.html.erb +4 -4
  27. data/app/views/admin/stats/_works.html.erb +8 -0
  28. data/app/views/collections/_form.html.erb +1 -1
  29. data/app/views/curation_concerns/base/_attribute_rows.html.erb +10 -10
  30. data/app/views/curation_concerns/base/_metadata.html.erb +1 -1
  31. data/app/views/curation_concerns/base/_relationships.html.erb +1 -1
  32. data/app/views/curation_concerns/file_sets/_descriptions.html.erb +1 -1
  33. data/app/views/error/404.html.erb +8 -19
  34. data/app/views/layouts/error.html.erb +3 -3
  35. data/app/views/layouts/homepage.html.erb +1 -1
  36. data/app/views/layouts/sufia-dashboard.html.erb +1 -1
  37. data/app/views/layouts/sufia-one-column.html.erb +1 -1
  38. data/app/views/{_footer.html.erb → shared/_footer.html.erb} +1 -1
  39. data/app/views/stats/file.html.erb +0 -1
  40. data/app/views/stats/work.html.erb +0 -2
  41. data/lib/generators/sufia/install_generator.rb +6 -0
  42. data/lib/sufia/engine.rb +1 -0
  43. data/lib/sufia/version.rb +1 -1
  44. data/spec/controllers/my/shares_controller_spec.rb +6 -7
  45. data/spec/controllers/transfers_controller_spec.rb +10 -0
  46. data/spec/features/batch_edit_spec.rb +1 -1
  47. data/spec/lib/sufia/analytics_spec.rb +18 -10
  48. data/spec/presenters/sufia/admin_stats_presenter_spec.rb +21 -14
  49. data/spec/search_builder/{sufia_search_builder_spec.rb → sufia/catalog_search_builder_spec.rb} +1 -1
  50. data/spec/search_builder/sufia/my_shares_search_builder_spec.rb +18 -0
  51. data/spec/services/statistics/{collections_spec.rb → collections/over_time_spec.rb} +1 -1
  52. data/spec/services/{sufia/admin/depositor_stats_spec.rb → statistics/depositors/summary_spec.rb} +5 -7
  53. data/spec/services/statistics/file_sets/by_format_spec.rb +30 -0
  54. data/spec/services/statistics/system_stats_spec.rb +54 -0
  55. data/spec/services/statistics/works/by_depositor_spec.rb +25 -0
  56. data/spec/services/statistics/works/by_resource_type_spec.rb +21 -0
  57. data/spec/services/statistics/works/count_spec.rb +42 -0
  58. data/spec/services/statistics/{works_spec.rb → works/over_time_spec.rb} +1 -1
  59. data/spec/views/admin/stats/index.html.erb_spec.rb +3 -6
  60. data/spec/views/curation_concerns/base/_relationships.html.erb_spec.rb +4 -1
  61. data/sufia.gemspec +2 -1
  62. metadata +49 -25
  63. data/app/services/sufia/admin/depositor_stats.rb +0 -48
  64. data/app/services/sufia/statistics/collections.rb +0 -12
  65. data/app/services/sufia/statistics/works.rb +0 -12
  66. data/app/services/sufia/system_stats.rb +0 -120
  67. data/app/views/admin/stats/_files.html.erb +0 -8
  68. data/lib/generators/sufia/fulltext_generator.rb +0 -26
  69. data/spec/services/sufia/system_stats_spec.rb +0 -224
  70. data/vendor/assets/javascripts/flot/excanvas.js +0 -1428
  71. data/vendor/assets/javascripts/flot/jquery.flot.js +0 -3168
  72. data/vendor/assets/javascripts/flot/jquery.flot.selection.js +0 -360
  73. data/vendor/assets/javascripts/flot/jquery.flot.time.js +0 -432
@@ -15,7 +15,7 @@ describe 'curation_concerns/base/relationships' do
15
15
  end
16
16
 
17
17
  context "when collections are present" do
18
- let(:collection_presenters) { [double(id: '456', title: 'Containing collection')] }
18
+ let(:collection_presenters) { [double(id: '456', title: ['Containing collection', 'foobar'], to_s: 'Containing collection')] }
19
19
  let(:page) { Capybara::Node::Simple.new(rendered) }
20
20
  before do
21
21
  allow(presenter).to receive(:collection_presenters).and_return(collection_presenters)
@@ -24,5 +24,8 @@ describe 'curation_concerns/base/relationships' do
24
24
  it "links to collections" do
25
25
  expect(page).to have_link 'Containing collection'
26
26
  end
27
+ it "labels the link using the presenter's #to_s method" do
28
+ expect(page).not_to have_content 'foobar'
29
+ end
27
30
  end
28
31
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.version = Sufia::VERSION
19
19
  spec.license = 'Apache2'
20
20
 
21
- spec.add_dependency 'curation_concerns', '>= 1.0.0.beta7', '< 2'
21
+ spec.add_dependency 'curation_concerns', '>= 1.0.0.beta8', '< 2'
22
22
  spec.add_dependency 'hydra-batch-edit', '~> 2.0'
23
23
  spec.add_dependency 'browse-everything', '~> 0.10'
24
24
  spec.add_dependency 'blacklight-gallery', '~> 0.1'
@@ -43,6 +43,7 @@ Gem::Specification.new do |spec|
43
43
  spec.add_dependency 'jquery-ui-rails', '~> 5.0'
44
44
  spec.add_dependency 'zeroclipboard-rails', '~> 0.0.13'
45
45
  spec.add_dependency 'redis-namespace', '~> 1.5.2'
46
+ spec.add_dependency 'flot-rails', '~> 0.0.6'
46
47
 
47
48
  spec.add_development_dependency 'engine_cart', '~> 0.8'
48
49
  spec.add_development_dependency 'mida', '~> 0.3'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sufia
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0.beta1
4
+ version: 7.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-06-03 00:00:00.000000000 Z
15
+ date: 2016-06-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: curation_concerns
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.0.0.beta7
23
+ version: 1.0.0.beta8
24
24
  - - "<"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2'
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0.beta7
33
+ version: 1.0.0.beta8
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
36
  version: '2'
@@ -382,6 +382,20 @@ dependencies:
382
382
  - - "~>"
383
383
  - !ruby/object:Gem::Version
384
384
  version: 1.5.2
385
+ - !ruby/object:Gem::Dependency
386
+ name: flot-rails
387
+ requirement: !ruby/object:Gem::Requirement
388
+ requirements:
389
+ - - "~>"
390
+ - !ruby/object:Gem::Version
391
+ version: 0.0.6
392
+ type: :runtime
393
+ prerelease: false
394
+ version_requirements: !ruby/object:Gem::Requirement
395
+ requirements:
396
+ - - "~>"
397
+ - !ruby/object:Gem::Version
398
+ version: 0.0.6
385
399
  - !ruby/object:Gem::Dependency
386
400
  name: engine_cart
387
401
  requirement: !ruby/object:Gem::Requirement
@@ -858,7 +872,6 @@ files:
858
872
  - app/search_builders/sufia/my_works_search_builder.rb
859
873
  - app/search_builders/sufia/search_builder.rb
860
874
  - app/services/sufia/actor_factory.rb
861
- - app/services/sufia/admin/depositor_stats.rb
862
875
  - app/services/sufia/analytics.rb
863
876
  - app/services/sufia/audit_failure_service.rb
864
877
  - app/services/sufia/batch_create_failure_service.rb
@@ -872,10 +885,16 @@ files:
872
885
  - app/services/sufia/message_user_service.rb
873
886
  - app/services/sufia/query_service.rb
874
887
  - app/services/sufia/repository_audit_service.rb
875
- - app/services/sufia/statistics/collections.rb
888
+ - app/services/sufia/statistics/collections/over_time.rb
889
+ - app/services/sufia/statistics/depositors/summary.rb
890
+ - app/services/sufia/statistics/file_sets/by_format.rb
876
891
  - app/services/sufia/statistics/over_time.rb
877
- - app/services/sufia/statistics/works.rb
878
- - app/services/sufia/system_stats.rb
892
+ - app/services/sufia/statistics/system_stats.rb
893
+ - app/services/sufia/statistics/term_query.rb
894
+ - app/services/sufia/statistics/works/by_depositor.rb
895
+ - app/services/sufia/statistics/works/by_resource_type.rb
896
+ - app/services/sufia/statistics/works/count.rb
897
+ - app/services/sufia/statistics/works/over_time.rb
879
898
  - app/services/sufia/user_stat_importer.rb
880
899
  - app/services/sufia/work_thumbnail_path_service.rb
881
900
  - app/uploaders/sufia/avatar_uploader.rb
@@ -883,7 +902,6 @@ files:
883
902
  - app/uploaders/tinymce_asset_uploader.rb
884
903
  - app/views/_controls.html.erb
885
904
  - app/views/_flash_msg.html.erb
886
- - app/views/_footer.html.erb
887
905
  - app/views/_ga.html.erb
888
906
  - app/views/_head_tag_extras.html.erb
889
907
  - app/views/_logo.html.erb
@@ -892,10 +910,10 @@ files:
892
910
  - app/views/_user_util_links.html.erb
893
911
  - app/views/admin/stats/_date_form.html.erb
894
912
  - app/views/admin/stats/_deposits.html.erb
895
- - app/views/admin/stats/_files.html.erb
896
913
  - app/views/admin/stats/_new_users.html.erb
897
914
  - app/views/admin/stats/_stats_by_date.html.erb
898
915
  - app/views/admin/stats/_top_data.html.erb
916
+ - app/views/admin/stats/_works.html.erb
899
917
  - app/views/admin/stats/index.html.erb
900
918
  - app/views/advanced/_advanced_search_facets.html.erb
901
919
  - app/views/advanced/_advanced_search_fields.html.erb
@@ -1064,6 +1082,7 @@ files:
1064
1082
  - app/views/records/show_fields/_subject.html.erb
1065
1083
  - app/views/records/show_fields/_title.html.erb
1066
1084
  - app/views/shared/_citations.html.erb
1085
+ - app/views/shared/_footer.html.erb
1067
1086
  - app/views/static/agreement.html.erb
1068
1087
  - app/views/static/help.html.erb
1069
1088
  - app/views/static/mendeley.html.erb
@@ -1126,7 +1145,6 @@ files:
1126
1145
  - lib/generators/sufia/cached_work_stats_generator.rb
1127
1146
  - lib/generators/sufia/citation_config_generator.rb
1128
1147
  - lib/generators/sufia/config_generator.rb
1129
- - lib/generators/sufia/fulltext_generator.rb
1130
1148
  - lib/generators/sufia/geonames_username_config_generator.rb
1131
1149
  - lib/generators/sufia/install_generator.rb
1132
1150
  - lib/generators/sufia/minimagick_config_generator.rb
@@ -1374,15 +1392,21 @@ files:
1374
1392
  - spec/routing/ownership_transfers_route_spec.rb
1375
1393
  - spec/routing/route_spec.rb
1376
1394
  - spec/routing/stats_route_spec.rb
1377
- - spec/search_builder/sufia_search_builder_spec.rb
1395
+ - spec/search_builder/sufia/catalog_search_builder_spec.rb
1396
+ - spec/search_builder/sufia/my_shares_search_builder_spec.rb
1378
1397
  - spec/services/collection_member_service_spec.rb
1379
1398
  - spec/services/collection_size_service_spec.rb
1380
1399
  - spec/services/file_set_csv_service_spec.rb
1381
1400
  - spec/services/repository_audit_service_spec.rb
1382
- - spec/services/statistics/collections_spec.rb
1383
- - spec/services/statistics/works_spec.rb
1401
+ - spec/services/statistics/collections/over_time_spec.rb
1402
+ - spec/services/statistics/depositors/summary_spec.rb
1403
+ - spec/services/statistics/file_sets/by_format_spec.rb
1404
+ - spec/services/statistics/system_stats_spec.rb
1405
+ - spec/services/statistics/works/by_depositor_spec.rb
1406
+ - spec/services/statistics/works/by_resource_type_spec.rb
1407
+ - spec/services/statistics/works/count_spec.rb
1408
+ - spec/services/statistics/works/over_time_spec.rb
1384
1409
  - spec/services/sufia/actor_factory_spec.rb
1385
- - spec/services/sufia/admin/depositor_stats_spec.rb
1386
1410
  - spec/services/sufia/audit_failure_service_spec.rb
1387
1411
  - spec/services/sufia/batch_create_failure_service_spec.rb
1388
1412
  - spec/services/sufia/batch_create_success_service_spec.rb
@@ -1390,7 +1414,6 @@ files:
1390
1414
  - spec/services/sufia/import_url_failure_service_spec.rb
1391
1415
  - spec/services/sufia/import_url_success_service_spec.rb
1392
1416
  - spec/services/sufia/query_service_spec.rb
1393
- - spec/services/sufia/system_stats_spec.rb
1394
1417
  - spec/spec_helper.rb
1395
1418
  - spec/support/features.rb
1396
1419
  - spec/support/features/session_helpers.rb
@@ -1463,10 +1486,6 @@ files:
1463
1486
  - vendor/assets/javascripts/fileupload/jquery.iframe-transport.js
1464
1487
  - vendor/assets/javascripts/fileupload/tmpl.js
1465
1488
  - vendor/assets/javascripts/fixedsticky.js
1466
- - vendor/assets/javascripts/flot/excanvas.js
1467
- - vendor/assets/javascripts/flot/jquery.flot.js
1468
- - vendor/assets/javascripts/flot/jquery.flot.selection.js
1469
- - vendor/assets/javascripts/flot/jquery.flot.time.js
1470
1489
  - vendor/assets/javascripts/jquery.validate.js
1471
1490
  - vendor/assets/javascripts/nestable.js
1472
1491
  homepage: http://sufia.io/
@@ -1666,15 +1685,21 @@ test_files:
1666
1685
  - spec/routing/ownership_transfers_route_spec.rb
1667
1686
  - spec/routing/route_spec.rb
1668
1687
  - spec/routing/stats_route_spec.rb
1669
- - spec/search_builder/sufia_search_builder_spec.rb
1688
+ - spec/search_builder/sufia/catalog_search_builder_spec.rb
1689
+ - spec/search_builder/sufia/my_shares_search_builder_spec.rb
1670
1690
  - spec/services/collection_member_service_spec.rb
1671
1691
  - spec/services/collection_size_service_spec.rb
1672
1692
  - spec/services/file_set_csv_service_spec.rb
1673
1693
  - spec/services/repository_audit_service_spec.rb
1674
- - spec/services/statistics/collections_spec.rb
1675
- - spec/services/statistics/works_spec.rb
1694
+ - spec/services/statistics/collections/over_time_spec.rb
1695
+ - spec/services/statistics/depositors/summary_spec.rb
1696
+ - spec/services/statistics/file_sets/by_format_spec.rb
1697
+ - spec/services/statistics/system_stats_spec.rb
1698
+ - spec/services/statistics/works/by_depositor_spec.rb
1699
+ - spec/services/statistics/works/by_resource_type_spec.rb
1700
+ - spec/services/statistics/works/count_spec.rb
1701
+ - spec/services/statistics/works/over_time_spec.rb
1676
1702
  - spec/services/sufia/actor_factory_spec.rb
1677
- - spec/services/sufia/admin/depositor_stats_spec.rb
1678
1703
  - spec/services/sufia/audit_failure_service_spec.rb
1679
1704
  - spec/services/sufia/batch_create_failure_service_spec.rb
1680
1705
  - spec/services/sufia/batch_create_success_service_spec.rb
@@ -1682,7 +1707,6 @@ test_files:
1682
1707
  - spec/services/sufia/import_url_failure_service_spec.rb
1683
1708
  - spec/services/sufia/import_url_success_service_spec.rb
1684
1709
  - spec/services/sufia/query_service_spec.rb
1685
- - spec/services/sufia/system_stats_spec.rb
1686
1710
  - spec/spec_helper.rb
1687
1711
  - spec/support/features.rb
1688
1712
  - spec/support/features/session_helpers.rb
@@ -1,48 +0,0 @@
1
- # Gather information about the depositors who have contributed to the repository
2
- class Sufia::Admin::DepositorStats
3
- include Blacklight::SearchHelper
4
-
5
- # @param [String] start_date optionally specify the start date to gather the stats from
6
- # @param [String] end_date optionally specify the end date to gather the stats from
7
- def initialize(start_date, end_date)
8
- @start_dt = Time.zone.parse(start_date) unless start_date.blank?
9
- @end_dt = Time.zone.parse(end_date).end_of_day unless end_date.blank?
10
- end
11
-
12
- attr_accessor :start_dt, :end_dt
13
-
14
- def depositors
15
- # step through the array by twos to get each pair
16
- results.map do |key, deposits|
17
- user = User.find_by_user_key(key)
18
- { key: key, deposits: deposits, user: user }
19
- end
20
- end
21
-
22
- private
23
-
24
- delegate :blacklight_config, to: CatalogController
25
- delegate :depositor_field, to: DepositSearchBuilder
26
-
27
- # results come from Solr in an array where the first item is the user and
28
- # the second item is the count
29
- # [ abc123, 55, ccczzz, 205 ]
30
- # @return [#each] an enumerable object of tuples (user and count)
31
- def results
32
- facet_results = repository.search(query)
33
- facet_results.facet_fields[depositor_field].each_slice(2)
34
- end
35
-
36
- def search_builder
37
- DepositSearchBuilder.new([:include_depositor_facet], self)
38
- end
39
-
40
- # TODO: This can probably be pushed into the DepositSearchBuilder
41
- def query
42
- search_builder.merge(q: date_query).query
43
- end
44
-
45
- def date_query
46
- Sufia::QueryService.new.build_date_query(start_dt, end_dt) unless start_dt.blank?
47
- end
48
- end
@@ -1,12 +0,0 @@
1
- module Sufia
2
- module Statistics
3
- class Collections < OverTime
4
- private
5
-
6
- def point(min, max)
7
- query = QueryService.new.build_date_query(min, max)
8
- Collection.where(query).count
9
- end
10
- end
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- module Sufia
2
- module Statistics
3
- class Works < OverTime
4
- private
5
-
6
- def point(min, max)
7
- query = QueryService.new.build_date_query(min, max)
8
- CurationConcerns::WorkRelation.new.where(query).count
9
- end
10
- end
11
- end
12
- end
@@ -1,120 +0,0 @@
1
- # A class that retrieves system level statistics about the system
2
- #
3
- # @attr_reader int limit limits the results returned from top_depositors and top_formats
4
- # Default is 5, maximum is 20, minimum is 5
5
- # @attr_reader int start_date Filters the statistics returned by the class to after the start date
6
- # blank means no filter
7
- # @attr_reader int end_date Filters the statistics returned by the class to before end date (end of day)
8
- # blank means today
9
- class Sufia::SystemStats
10
- attr_reader :limit, :start_date, :end_date
11
-
12
- # initialize the stats class setting the limitations
13
- #
14
- # @attr_reader int limit limits the results returned from top_depositors and top_formats
15
- # Default is 5, maximum is 20, minimum is 5
16
- # @attr_reader int start_date Filters the statistics returned by the class to after the start date
17
- # blank means no filter
18
- # @attr_reader int end_date Filters the statistics returned by the class to before end date (end of day)
19
- # blank means today
20
- def initialize(limit_records = 5, start_date_str = nil, end_date_str = nil)
21
- @limit = validate_limit(limit_records)
22
- @start_date = Time.zone.parse(start_date_str).beginning_of_day unless start_date_str.blank?
23
- @end_date = Time.zone.parse(end_date_str).end_of_day unless end_date_str.blank?
24
- end
25
-
26
- # returns the total files in the system filtered by the start_date and end_date if present
27
- #
28
- # @return [Hash] A hash with the total files by permission for the system
29
- # @option [Number] :total Total number of files without regard to permissions
30
- # @option [Number] :public Total number of files that have public permissions
31
- # @option [Number] :registered Total number of files that have registered (logged in) permissions
32
- # @option [Number] :private Total number of files that have private permissions
33
- def document_by_permission
34
- return document_by_date_by_permission if start_date
35
-
36
- files_count = {}
37
- files_count[:total] = query_service.count
38
- files_count[:public] = query_service.where_public.count
39
- files_count[:registered] = query_service.where_registered.count
40
- files_count[:private] = files_count[:total] - (files_count[:registered] + files_count[:public])
41
- files_count
42
- end
43
-
44
- # returns a list (of size limit) of system users (depositors) that have the most deposits in the system
45
- # @return [Hash] a hash with the user name as the key and the number of deposits as the value
46
- # { 'cam156' => 25, 'hjc14' => 24 ... }
47
- def top_depositors
48
- top_data(depositor_field, limit)
49
- end
50
-
51
- delegate :depositor_field, to: DepositSearchBuilder
52
-
53
- # returns a list (of size limit) of file formats (mime_types) that have the most files in the system
54
- # @return [Hash] a hash with the file format as the key and the number of files as the value
55
- # { 'png' => 25, 'pdf' => 24 ... }
56
- def top_formats
57
- format_key = Solrizer.solr_name('file_format', Solrizer::Descriptor.new(:string, :indexed, :multivalued))
58
- top_data(format_key, limit)
59
- end
60
-
61
- # returns [Array<user>] a list (of size limit) of users most recently registered with the system
62
- #
63
- def recent_users
64
- # no dates return the top few based on limit
65
- return ::User.order('created_at DESC').limit(limit) if start_date.blank?
66
-
67
- ::User.recent_users start_date, end_date
68
- end
69
-
70
- # returns [Number] the number of currently registered users
71
- #
72
- def users_count
73
- ::User.count
74
- end
75
-
76
- private
77
-
78
- def validate_limit(count)
79
- if count.blank? || count < 5
80
- 5
81
- elsif count > 20
82
- 20
83
- else
84
- count
85
- end
86
- end
87
-
88
- def document_by_date_by_permission
89
- files_count = {}
90
- files_count[:total] = query_service.find_by_date_created(start_date, end_date).count
91
- files_count[:public] = query_service.find_public_in_date_range(start_date, end_date).count
92
- files_count[:registered] = query_service.find_registered_in_date_range(start_date, end_date).count
93
- files_count[:private] = files_count[:total] - (files_count[:registered] + files_count[:public])
94
- files_count
95
- end
96
-
97
- def query_service
98
- @query_service ||= Sufia::QueryService.new
99
- end
100
-
101
- def solr_connection
102
- ActiveFedora::SolrService.instance.conn
103
- end
104
-
105
- def top_data(key, limit)
106
- # Grab JSON response (looks like {"terms": {"depositor_tesim": {"mjg36": 3}}} for depositor)
107
- json = solr_connection.get 'terms', params: { 'terms.fl' => key,
108
- 'terms.sort' => 'count',
109
- 'terms.limit' => limit,
110
- wt: 'json',
111
- 'json.nl' => 'map',
112
- omitHeader: 'true' }
113
- unless json
114
- Rails.logger.error "Unable to reach TermsComponent via Solr connection. Is it enabled in your solr config?"
115
- return []
116
- end
117
-
118
- json['terms'][key]
119
- end
120
- end
@@ -1,8 +0,0 @@
1
- <h3>File Statistics (<%= @presenter.date_filter_string %>)</h3>
2
- <h4>Total Files: <%= @presenter.files_count[:total] %> </h4>
3
- <h4>Totals by Visibility</h4>
4
- <ul>
5
- <li>Open Access <span class="count">(<%= @presenter.files_count[:public] %>)</span></li>
6
- <li><%= t("sufia.admin.stats.registered") %> <span class="count">(<%= @presenter.files_count[:registered] %>)</span></li>
7
- <li>Private <span class="count">(<%= @presenter.files_count[:private] %>)</span></li>
8
- </ul>
@@ -1,26 +0,0 @@
1
- require 'rails/generators'
2
-
3
- class Sufia::FulltextGenerator < Rails::Generators::Base
4
- source_root File.expand_path('../templates', __FILE__)
5
-
6
- desc """
7
- This generator makes the following changes to your application:
8
- 1. Copies solrconfig.xml into solr_conf/conf/
9
- 2. Reconfigures jetty
10
- """
11
-
12
- def banner
13
- say_status("info", "GENERATING SUFIA FULL-TEXT", :blue)
14
- end
15
-
16
- # Copy Sufia's solrconfig into the dir from which the jetty:config task pulls
17
- # Sufia's solrconfig includes full-text extraction
18
- def copy_solr_config
19
- copy_file 'config/solrconfig.xml', 'solr_conf/conf/solrconfig.xml', force: true
20
- end
21
-
22
- # Copy config, schema, and jars into jetty dir if it exists
23
- def reconfigure_jetty
24
- rake "curation_concerns:jetty:config" if File.directory?('jetty')
25
- end
26
- end