-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
309,701 additions
and
29,245 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
db/warehouse/migrate/20240731155357_create_pm_coc_static_spms.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class CreatePmCoCStaticSpms < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :pm_coc_static_spms do |t| | ||
t.references :goal, null: false, index: true | ||
t.date :report_start, null: false | ||
t.date :report_end, null: false | ||
t.jsonb :data, null: false, default: {} | ||
t.timestamps | ||
t.datetime :deleted_at | ||
end | ||
end | ||
end |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...ement/app/controllers/performance_measurement/warehouse_reports/static_spms_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
### | ||
# Copyright 2016 - 2024 Green River Data Analysis, LLC | ||
# | ||
# License detail: https://github.com/greenriver/hmis-warehouse/blob/production/LICENSE.md | ||
### | ||
|
||
module PerformanceMeasurement::WarehouseReports | ||
class StaticSpmsController < ApplicationController | ||
# include WarehouseReportAuthorization | ||
include AjaxModalRails::Controller | ||
include ArelHelper | ||
before_action :set_goal | ||
|
||
def new | ||
@spm = spm_source.new(goal: @goal) | ||
end | ||
|
||
def edit | ||
@spm = spm_source.find(params[:id].to_i) | ||
end | ||
|
||
def create | ||
@spm = spm_source.create!({ goal: @goal }.merge(spm_params.to_h)) | ||
respond_with(@spm, location: edit_performance_measurement_warehouse_reports_goal_config_path(@goal)) | ||
end | ||
|
||
def destroy | ||
@spm = spm_source.find(params[:id].to_i) | ||
@spm.destroy | ||
respond_with(@goal, location: edit_performance_measurement_warehouse_reports_goal_config_path(@goal)) | ||
end | ||
|
||
private def set_goal | ||
@goal = goal_source.find(params[:goal_config_id].to_i) | ||
end | ||
|
||
private def goal_source | ||
PerformanceMeasurement::Goal | ||
end | ||
|
||
private def spm_source | ||
PerformanceMeasurement::StaticSpm | ||
end | ||
|
||
def spm_params | ||
params.require(:spm).permit( | ||
:report_start, | ||
:report_end, | ||
) | ||
end | ||
|
||
private def flash_interpolation_options | ||
{ resource_name: 'Static SPM' } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
drivers/performance_measurement/app/models/performance_measurement/static_spm.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
### | ||
# Copyright 2016 - 2024 Green River Data Analysis, LLC | ||
# | ||
# License detail: https://github.com/greenriver/hmis-warehouse/blob/production/LICENSE.md | ||
### | ||
|
||
module PerformanceMeasurement | ||
class StaticSpm < GrdaWarehouseBase | ||
self.table_name = :pm_coc_static_spms | ||
acts_as_paranoid | ||
|
||
belongs_to :goal | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
...rement/app/views/performance_measurement/warehouse_reports/goal_configs/_static_spms.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.d-flex | ||
.ml-auto.mb-4 | ||
= link_to new_performance_measurement_warehouse_reports_goal_config_static_spm_path(@goal), class: 'btn btn-secondary', data: { loads_in_ajax_modal: true } do | ||
%i.icon-plus | ||
Add Static SPM for Comparison | ||
%p | ||
You can optionally provide information from historic SPMs. If available These will be shown as the comparison values for values calculated by the SPM for the #{Translation.translate('CoC Performance Measurement Dashboard')} report where the comparison date range matches the entered data. | ||
- if @spms.present? | ||
.card.mb-4 | ||
%table.table.table-striped | ||
%thead | ||
%tr | ||
%th Report Start Date | ||
%th Report End Date | ||
%th | ||
%th | ||
%tbody | ||
- @spms.each do |spm| | ||
%tr | ||
%td= spm.report_start | ||
%td= spm.report_end | ||
%td | ||
= link_to edit_performance_measurement_warehouse_reports_goal_config_static_spm_path(@goal, spm), class: 'btn btn-sm btn-secondary', data: { loads_in_ajax_modal: true } do | ||
%i.icon-pencil | ||
Edit | ||
%td | ||
= link_to performance_measurement_warehouse_reports_goal_config_static_spm_path(@goal, spm), method: :delete, class: 'btn btn-sm btn-icon-only btn-danger', data: { confirm: "Are you sure you want to remove the static SPM (#{spm.report_start} - #{spm.report_end})?"} do | ||
%i.icon-cross |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...ce_measurement/app/views/performance_measurement/warehouse_reports/static_spms/_form.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
= f.input :report_start, as: :date_picker, label: 'SPM Start Date' | ||
= f.input :report_end, as: :date_picker, label: 'SPM End Date' |
6 changes: 6 additions & 0 deletions
6
...nce_measurement/app/views/performance_measurement/warehouse_reports/static_spms/edit.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- title = Translation.translate('Edit Static SPM for Comparison Calculations') | ||
- content_for :modal_title, title | ||
= simple_form_for @spm, as: :spm, url: performance_measurement_warehouse_reports_goal_config_static_spm_path(@goal, @spm) do |f| | ||
= render 'form', f: f | ||
|
||
= f.button :submit, 'Update Static SPM' |
6 changes: 6 additions & 0 deletions
6
...ance_measurement/app/views/performance_measurement/warehouse_reports/static_spms/new.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- title = Translation.translate('Add a Static SPM for Comparison Calculations') | ||
- content_for :modal_title, title | ||
= simple_form_for @spm, as: :spm, url: performance_measurement_warehouse_reports_goal_config_static_spms_path(@goal) do |f| | ||
= render 'form', f: f | ||
|
||
= f.button :submit, 'Add Static SPM' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters