diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 7e849439e..e0a3b41a5 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -233,7 +233,7 @@ jobs: - name: Run Rake test units run: | RUBYOPT="-W0" - bin/rails test test/unit/*.rb; + env IGNORE_ROLES=false bin/rails test test/unit/*.rb; - name: Upload code coverage to codecov.io uses: codecov/codecov-action@v3 with: @@ -273,7 +273,7 @@ jobs: - name: Run Rake test units lib run: | RUBYOPT="-W0" - bin/rails test test/unit/lib/*.rb; + env IGNORE_ROLES=false bin/rails test test/unit/lib/*.rb; - name: Upload code coverage to codecov.io uses: codecov/codecov-action@v3 with: @@ -282,7 +282,7 @@ jobs: - name: Run Rake test units lib cypress run: | RUBYOPT="-W0" - bin/rails test test/unit/lib/cypress/*.rb; + env IGNORE_ROLES=false bin/rails test test/unit/lib/cypress/*.rb; - name: Upload code coverage to codecov.io uses: codecov/codecov-action@v3 with: @@ -291,7 +291,7 @@ jobs: - name: Run Rake test units lib validators run: | RUBYOPT="-W0" - bin/rails test test/unit/lib/validators/*.rb; + env IGNORE_ROLES=false bin/rails test test/unit/lib/validators/*.rb; - name: Upload code coverage to codecov.io uses: codecov/codecov-action@v3 with: @@ -300,7 +300,7 @@ jobs: - name: Run Rake test models run: | RUBYOPT="-W0" - bin/rails test test/models; + env IGNORE_ROLES=false bin/rails test test/models; - name: Upload code coverage to codecov.io uses: codecov/codecov-action@v3 with: @@ -340,7 +340,7 @@ jobs: - name: Run Rake test:jobs run: | RUBYOPT="-W0" - bundle exec rake test:jobs; + env IGNORE_ROLES=false bundle exec rake test:jobs; - name: Upload code jobs coverage to codecov.io uses: codecov/codecov-action@v3 with: @@ -349,7 +349,7 @@ jobs: - name: Run Rake test:helpers run: | RUBYOPT="-W0" - bundle exec rake test:helpers; + env IGNORE_ROLES=false bundle exec rake test:helpers; - name: Upload code helpers coverage to codecov.io uses: codecov/codecov-action@v3 with: @@ -358,7 +358,7 @@ jobs: - name: Run Rake test:controllers run: | RUBYOPT="-W0" - bundle exec rake test:controllers; + env IGNORE_ROLES=false bundle exec rake test:controllers; - name: Upload controllers code coverage to codecov.io uses: codecov/codecov-action@v3 with: @@ -398,7 +398,7 @@ jobs: - name: Run Rake test run: | RUBYOPT="-W0" - bundle exec rake test:integration; + env IGNORE_ROLES=false bundle exec rake test:integration; - name: Upload code coverage to codecov.io uses: codecov/codecov-action@v3 with: diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index 0f9e11fa2..806a5403d 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -173,7 +173,7 @@ def measures_for_source { label: label_str, value: val } end - end.flatten.to_json.html_safe + end.flatten.to_json end end end diff --git a/app/javascript/controllers/measure_search_controller.js b/app/javascript/controllers/measure_search_controller.js index ca5dd0379..aa2534943 100644 --- a/app/javascript/controllers/measure_search_controller.js +++ b/app/javascript/controllers/measure_search_controller.js @@ -1,10 +1,8 @@ import { Controller } from "@hotwired/stimulus"; -import $ from "jquery2"; -import "jquery-ui"; // Connects data-controller="measure-search" export default class extends Controller { - static targets = ["input"]; + static targets = ["input", "allRecordsTemplate"]; static values = { // JSON array for jQueryUI autocomplete source source: String, @@ -23,49 +21,29 @@ export default class extends Controller { } initializeAutocomplete() { - const $input = $(this.inputTarget); - + const $ = window.jQuery; let source = []; try { source = JSON.parse(this.sourceValue || "[]"); } catch (e) { console.error("Bad source JSON", this.sourceValue, e); } - - $(document).ready(function () { - $input.autocomplete({ - delay: 500, - source: this.sourceValue, - select: (event, data) => { - $.get(data.item.value); - event.preventDefault(); - }, - focus: (event) => event.preventDefault, - }); + var availableTags = [{"label":"CMS349v7: HIV Screening","value":"/bundles/66797c1bdfe4bd02748db95e/records/by_measure?measure_id=2C928083-8907-CE68-0189-0DA36CC00327\u0026pop_set_key=PopulationSet_1"}]; + $( "#search_measures" ).autocomplete({ + delay: 500, + source: source, + select: (event, data) => { + $.get(data.item.value); + event.preventDefault(); + }, + focus: (event) => event.preventDefault }); - - const ac = $input.data("ui-autocomplete"); - if (!ac) return; - - ac._renderItem = function (ul, item) { - return $('
  • ').append(item.label).appendTo(ul); - }; - - ac._renderMenu = function (ul, items) { - const that = this; - $.each(items, function (_index, item) { - this._renderItemData(ul, item); - }); - $(ul).removeClass("ui-widget ui-widget-content").addClass("list-group"); - }; } bindKeyup() { $(this.inputTarget).on("keyup.measureSearch", () => { if (!$(this.inputTarget).val()) { - $("#records_list").html(this.allRecordsHtmlValue); - - if ($.rails?.refreshCSRFTokens) $.rails.refreshCSRFTokens(); + $("#records_list").html(this.allRecordsTemplateTarget.innerHTML); } }); } diff --git a/app/views/records/index.html.erb b/app/views/records/index.html.erb index e1dd9ae2a..a85dd0732 100644 --- a/app/views/records/index.html.erb +++ b/app/views/records/index.html.erb @@ -37,20 +37,7 @@
    + data-measure-search-source-value="<%= ERB::Util.json_escape(@measure_dropdown) %>"> +
    <% if !@task && !@product_test %> diff --git a/features/step_definitions/record.rb b/features/step_definitions/record.rb index 2783f60f1..550182e64 100644 --- a/features/step_definitions/record.rb +++ b/features/step_definitions/record.rb @@ -90,12 +90,11 @@ end And(/^the user selects a measure from the dropdown$/) do - byebug page.execute_script "$('#search_measures').trigger('focus')" page.execute_script "$('#search_measures').trigger('keydown')" - assert page.has_selector?('.ui-autocomplete .list-group-item'), 'no dropdown result' + assert page.has_selector?('.ui-autocomplete .ui-menu-item'), 'no dropdown result' - page.find('.ui-autocomplete .list-group-item', match: :first).click + page.find('.ui-autocomplete .ui-menu-item', match: :first).click end Then(/^the user should see results for that measure$/) do diff --git a/features/step_definitions/record_list.rb b/features/step_definitions/record_list.rb index d976f8b91..d61b7993e 100644 --- a/features/step_definitions/record_list.rb +++ b/features/step_definitions/record_list.rb @@ -15,7 +15,6 @@ # T H E N # Then(/^the user should see calculation results$/) do - byebug page.assert_text('Template Name') page.assert_text('IPOP') page.assert_selector('span.result-marker') diff --git a/test/fixtures/bundles/minimal_bundle_qdm_5_6.zip b/test/fixtures/bundles/minimal_bundle_qdm_5_6.zip index decc32f15..4ac72f458 100644 Binary files a/test/fixtures/bundles/minimal_bundle_qdm_5_6.zip and b/test/fixtures/bundles/minimal_bundle_qdm_5_6.zip differ diff --git a/test/helpers/test_executions_helper_test.rb b/test/helpers/test_executions_helper_test.rb index 2b280a70a..3ed859872 100644 --- a/test/helpers/test_executions_helper_test.rb +++ b/test/helpers/test_executions_helper_test.rb @@ -205,11 +205,11 @@ def test_padding_cms_id end def test_ecqi_link - # test with a measure from the 2023 reporting period - bundle2022 = Bundle.create(version: '2022.5.0') - measure2022 = Measure.create(reporting_program_type: 'ep', cms_id: 'CMS161v11', bundle_id: bundle2022.id) - ecqi_url2022 = ecqi_link(measure2022.cms_id) - ecqi_request2022 = RestClient::Request.execute(method: :get, url: ecqi_url2022) - assert_equal 200, ecqi_request2022.code + # test with a measure from the 2025 reporting period + bundle2024 = Bundle.create(version: '2024.5.0') + measure2024 = Measure.create(reporting_program_type: 'ep', cms_id: 'CMS128v13', bundle_id: bundle2024.id) + ecqi_url2024 = ecqi_link(measure2024.cms_id) + ecqi_request2024 = RestClient::Request.execute(method: :get, url: ecqi_url2024) + assert_equal 200, ecqi_request2024.code end end diff --git a/test/unit/lib/cypress/cql_bundle_importer_test.rb b/test/unit/lib/cypress/cql_bundle_importer_test.rb index 6c05db4c3..20e63b15e 100644 --- a/test/unit/lib/cypress/cql_bundle_importer_test.rb +++ b/test/unit/lib/cypress/cql_bundle_importer_test.rb @@ -20,7 +20,7 @@ class CqlBundleImporterTest < ActiveSupport::TestCase Cypress::CqlBundleImporter.import(bundle_zip, Tracker.new) assert_equal (before_measure_count + 2), Measure.count # 21 valuesets from csv file, 3 direct reference codes - assert_equal (before_value_set_count + 25), ValueSet.count + assert_equal (before_value_set_count + 27), ValueSet.count assert_equal (before_patient_count + 1), Patient.count # only 2 individual results are saved assert_equal (before_results_count + 2), IndividualResult.count @@ -46,7 +46,7 @@ class CqlBundleImporterTest < ActiveSupport::TestCase Cypress::CqlBundleImporter.import(bundle_zip, Tracker.new, include_highlighting: true) assert_equal (before_measure_count + 2), Measure.count # 21 valuesets from csv file, 3 direct reference codes - assert_equal (before_value_set_count + 25), ValueSet.count + assert_equal (before_value_set_count + 27), ValueSet.count assert_equal (before_patient_count + 1), Patient.count # only 2 individual results are saved assert_equal (before_results_count + 2), IndividualResult.count