app/controllers/providers_controller.rb
# load resource must be before authorize resource
load resource must be before authorize resource
load resource must be before authorize resource
def measure
    @selected_providers = Provider.selected_or_all(params[:selected_provider_ids]).alphabetical
    @selected_races = (params[:selected_race_ids] && !params[:selected_race_ids].empty?) ? Race.selected(params[:selected_race_ids]).ordered : []
    @selected_genders = (params[:selected_genders] && !params[:selected_genders].empty?) ? params[:selected_genders] : []
    @definition = QME::QualityMeasure.new(params[:measure_id], params[:sub_id]).definition
    calculate_measure_for_selected(@definition["id"], @definition['sub_id'], providers: @selected_providers, races: @selected_races, genders: @selected_genders)
    respond_to do |wants|
      wants.html do 
        @teams = Team.alphabetical
        @races = Race.ordered
        @genders = [{name: 'Male', key: 'M'}, {name: 'Female', key: 'F'}]
      end
      wants.json do
        complete = @provider_job_uuids.empty? && @aggregate_quality_report_uuid.nil?
        render json: {aggregate: @aggregate_quality_report.result, providers: @provider_reports, aggregate_job: @aggregate_quality_report_uuid, provider_jobs: @provider_job_uuids, :complete => complete}.to_json
      end
    end
  end
def measure @selected_providers = Provider . selected_or_all ( params [ :selected_provider_ids ] ) . alphabetical @selected_races = ( params [ :selected_race_ids ] && ! params [ :selected_race_ids ] . empty? ) ? Race . selected ( params [ :selected_race_ids ] ) . ordered : [ ] @selected_genders = ( params [ :selected_genders ] && ! params [ :selected_genders ] . empty? ) ? params [ :selected_genders ] : [ ] @definition = QME :: QualityMeasure . new ( params [ :measure_id ] , params [ :sub_id ] ) . definition calculate_measure_for_selected ( @definition [ "id" ] , @definition [ 'sub_id' ] , providers : @selected_providers , races : @selected_races , genders : @selected_genders ) respond_to do | wants | wants . html do @teams = Team . alphabetical @races = Race . ordered @genders = [ { name : 'Male' , key : 'M' } , { name : 'Female' , key : 'F' } ] end wants . json do complete = @provider_job_uuids . empty? && @aggregate_quality_report_uuid . nil? render json : { aggregate : @aggregate_quality_report . result , providers : @provider_reports , aggregate_job : @aggregate_quality_report_uuid , provider_jobs : @provider_job_uuids , :complete => complete } . to_json end end end
load resource must be before authorize resource
load resource must be before authorize resource