From cf08a91097aadac7cf97d59375f5af403a366082 Mon Sep 17 00:00:00 2001 From: Serhii Ilin Date: Tue, 9 Feb 2021 10:02:11 -0500 Subject: [PATCH] MAT-2214 Sort Bonnie Dropdown's Alphabetically (#1765) * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically * MAT-2214 Sort Bonnie Dropdown's Alphabetically --- .../javascripts/helpers/data_criteria_helpers.js.coffee | 2 +- app/assets/javascripts/models/measure.js.coffee | 2 +- .../patient_builder/data_criteria_attribute_editor.js.coffee | 4 ++-- .../javascripts/views/patient_builder/inputs/code.js.coffee | 4 +++- .../javascripts/views/patient_builder/inputs/coding.js.coffee | 4 +++- .../patient/patient_builder_spec.js.coffee | 2 +- spec/teaspoon_env.rb | 4 ++-- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/helpers/data_criteria_helpers.js.coffee b/app/assets/javascripts/helpers/data_criteria_helpers.js.coffee index a3392fd80..fa823cd53 100644 --- a/app/assets/javascripts/helpers/data_criteria_helpers.js.coffee +++ b/app/assets/javascripts/helpers/data_criteria_helpers.js.coffee @@ -165,7 +165,7 @@ @getAttributes: (dataElement) -> resourceType = dataElement.fhir_resource?.resourceType - attributes = @DATA_ELEMENT_ATTRIBUTES[resourceType] + attributes = @DATA_ELEMENT_ATTRIBUTES[resourceType]?.sort( (a, b) -> a.path.localeCompare(b.path) ) return attributes || [] @getAttribute: (dataElement, path) -> diff --git a/app/assets/javascripts/models/measure.js.coffee b/app/assets/javascripts/models/measure.js.coffee index fb15b3709..36fc5149e 100644 --- a/app/assets/javascripts/models/measure.js.coffee +++ b/app/assets/javascripts/models/measure.js.coffee @@ -14,7 +14,7 @@ class Thorax.Models.Measure extends Thorax.Model # TODO: migrate to thoraxMeasure.cqmValueSets = thoraxMeasure.cqmMeasure.value_sets if attrs.value_sets? - thoraxMeasure.cqmValueSets = attrs.value_sets + thoraxMeasure.cqmValueSets = attrs.value_sets?.sort( (a, b) -> a.name?.localeCompare(b.name) ) else thoraxMeasure.cqmValueSets = [] diff --git a/app/assets/javascripts/views/patient_builder/data_criteria_attribute_editor.js.coffee b/app/assets/javascripts/views/patient_builder/data_criteria_attribute_editor.js.coffee index 958078cc2..3545bf0cf 100644 --- a/app/assets/javascripts/views/patient_builder/data_criteria_attribute_editor.js.coffee +++ b/app/assets/javascripts/views/patient_builder/data_criteria_attribute_editor.js.coffee @@ -13,9 +13,9 @@ class Thorax.Views.DataCriteriaAttributeEditorView extends Thorax.Views.BonnieVi @attributeList.push( name: attr.path title: attr.title - types: attr.types + types: attr.types?.sort() valueSets: attr.valueSets?() - referenceTypes: attr.referenceTypes + referenceTypes: attr.referenceTypes?.sort() ) # TODO FHIR attributes # @dataElement.schema.eachPath (path, info) => diff --git a/app/assets/javascripts/views/patient_builder/inputs/code.js.coffee b/app/assets/javascripts/views/patient_builder/inputs/code.js.coffee index ae9fe0758..0d0619667 100644 --- a/app/assets/javascripts/views/patient_builder/inputs/code.js.coffee +++ b/app/assets/javascripts/views/patient_builder/inputs/code.js.coffee @@ -191,9 +191,11 @@ class Thorax.Views.InputCodeView extends Thorax.Views.BonnieView # Helper that builds up the custom code system dropdown based on all code systems in the measure. _populateCustomCodeSystemDropdown: -> - @allCodeSystems = [{system: '', name: 'Custom'}] + @allCodeSystems = [] for system, name of @codeSystems @allCodeSystems.push {system: system, name: name} + @allCodeSystems.sort( (a, b) -> a.name?.localeCompare(b.name) ) + @allCodeSystems.splice(0, 0, {system: '', name: 'Custom'}) # wipeout code system selection and replace options codeSystemSelect = @$('select[name="custom_codesystem_select"]').empty() diff --git a/app/assets/javascripts/views/patient_builder/inputs/coding.js.coffee b/app/assets/javascripts/views/patient_builder/inputs/coding.js.coffee index 9059086ab..a4ef8826e 100644 --- a/app/assets/javascripts/views/patient_builder/inputs/coding.js.coffee +++ b/app/assets/javascripts/views/patient_builder/inputs/coding.js.coffee @@ -247,9 +247,11 @@ class Thorax.Views.InputCodingView extends Thorax.Views.BonnieView # Helper that builds up the custom code system dropdown based on all code systems in the measure. _populateCustomCodeSystemDropdown: -> - @allCodeSystems = [{system: '', name: 'Custom'}] + @allCodeSystems = [] for system, name of @codeSystems @allCodeSystems.push {system: system, name: name} + @allCodeSystems.sort( (a, b) -> a.name?.localeCompare(b.name) ) + @allCodeSystems.splice(0, 0, {system: '', name: 'Custom'}) # wipeout code system selection and replace options codeSystemSelect = @$('select[name="custom_codesystem_select"]').empty() diff --git a/spec/javascripts/patient_builder_tests/patient/patient_builder_spec.js.coffee b/spec/javascripts/patient_builder_tests/patient/patient_builder_spec.js.coffee index 02639e67a..718954479 100644 --- a/spec/javascripts/patient_builder_tests/patient/patient_builder_spec.js.coffee +++ b/spec/javascripts/patient_builder_tests/patient/patient_builder_spec.js.coffee @@ -1,7 +1,7 @@ describe 'PatientBuilderView', -> beforeEach (done) -> - jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000; jasmine.getJSONFixtures().clearCache() @measure = loadFhirMeasure 'fhir_measure_data/CMS104_eoc.json' @patients = new Thorax.Collections.Patients [getJSONFixture('fhir_patients/CMS104_eoc/mickey_mouse.json')], parse: true diff --git a/spec/teaspoon_env.rb b/spec/teaspoon_env.rb index d8c18bfb9..2245f355c 100644 --- a/spec/teaspoon_env.rb +++ b/spec/teaspoon_env.rb @@ -138,7 +138,7 @@ class Selenium::WebDriver::Remote::Http::Default def initialize(open_timeout: nil, read_timeout: nil) @open_timeout = open_timeout - @read_timeout = 360 + @read_timeout = 500 end end @@ -182,7 +182,7 @@ def run_specs(runner, url) # Specify the timeout for the driver. Specs are expected to complete within # this time frame or the run will be considered a failure. This is to avoid # issues that can arise where tests stall. - config.driver_timeout = 800 + config.driver_timeout = 200000 # Specify a server to use with Rack (e.g. thin, mongrel). If nil is provided # Rack::Server is used.