• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uclibs / ucrate / b55db03c-843f-45a9-98b3-f75772ac783c

16 Apr 2025 05:43PM UTC coverage: 54.567% (-19.5%) from 74.06%
b55db03c-843f-45a9-98b3-f75772ac783c

push

circleci

web-flow
Add github workflow to trigger Teams webhook to notify for PR (#1179)

2103 of 3854 relevant lines covered (54.57%)

42.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/controllers/sitemaps_controller.rb
1
# frozen_string_literal: true
2

3
class SitemapsController < ApplicationController
×
4
  def index
×
5
    work_types = Hyrax.config.registered_curation_concern_types.append('Collection')
×
6

7
    @root_url = Rails.application.config.application_root_url
×
8
    @catalog_urls = []
×
9
    @resources = []
×
10

11
    @static_pages = StaticController.instance_methods(false).map { |action| get_static_url action }
×
12
    @catalog_urls.append strip_locale_from_url search_catalog_url
×
13

14
    work_types.each do |work_type|
×
15
      @catalog_urls << retrieve_facet_urls(work_type)
×
16
      retrieve_works_from_solr work_type
×
17
    end
×
18

19
    @static_pages.map! { |page_url| strip_locale_from_url page_url }
×
20

21
    respond_to { |format| format.xml }
×
22
  end
×
23

24
  private
×
25

26
  def retrieve_works_from_solr(work_type)
×
27
    ActiveFedora::SolrService.query("has_model_ssim:#{work_type}", rows: 1_000_000).each do |work|
×
28
      next if work[:read_access_group_ssim] != ['public']
×
29
      work_metadata = {}
×
30
      work_metadata[:url] = sans_fedora_poly_url(work_type, work[:id])
×
31
      work_metadata[:lastmod] = work[:system_modified_dtsi].gsub(/T[0-9]{2}:[0-9]{2}:[0-9]{2}Z/, '')
×
32
      @resources << work_metadata
×
33
    end
×
34
  end
×
35

36
  def sans_fedora_poly_url(work_type, work_id)
×
37
    strip_locale_from_url(@root_url + "/#{url_prefix(work_type)}#{work_type.underscore.pluralize}/#{work_id}")
×
38
  end
×
39

40
  def url_prefix(work_type)
×
41
    return 'concern/' unless work_type == 'Collection'
×
42
    ''
×
43
  end
×
44

45
  def retrieve_facet_urls(work_type)
×
46
    strip_locale_from_url(@root_url + "/catalog?f[human_readable_type_sim][]=#{work_type}")
×
47
  end
×
48

49
  def strip_locale_from_url(url_with_locale)
×
50
    url_with_locale.gsub('?locale=en', '')
×
51
  end
×
52

53
  def get_static_url(action)
×
54
    send "#{action}_url"
×
55
  end
×
56
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc