Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various reports fixes #1240

Merged
merged 10 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ GEM
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
arel (9.0.0)
ast (2.4.0)
ast (2.4.1)
auto_strip_attributes (2.6.0)
activerecord (>= 4.0)
autoprefixer-rails (9.7.6)
Expand Down Expand Up @@ -270,11 +270,11 @@ GEM
nenv (~> 0.1)
shellany (~> 0.0)
orm_adapter (0.5.0)
parallel (1.19.1)
parallel (1.19.2)
parallel_tests (2.32.0)
parallel
parser (2.7.1.2)
ast (~> 2.4.0)
parser (2.7.1.4)
ast (~> 2.4.1)
passenger (6.0.4)
rack
rake (>= 0.8.1)
Expand Down Expand Up @@ -419,15 +419,19 @@ GEM
rswag-ui (1.6.0)
actionpack (>= 3.1, < 6.0)
railties (>= 3.1, < 6.0)
rubocop (0.83.0)
rubocop (0.89.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.3.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-performance (1.5.2)
rubocop (>= 0.71.0)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
rubocop-performance (1.7.1)
rubocop (>= 0.82.0)
ruby-graphviz (1.2.5)
rexml
ruby-progressbar (1.10.1)
Expand Down Expand Up @@ -481,9 +485,9 @@ GEM
net-ssh (>= 2.8.0)
sshkit-interactive (0.3.0)
sshkit (~> 1.12)
standard (0.4.2)
rubocop (~> 0.83.0)
rubocop-performance (~> 1.5.2)
standard (0.5.1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required to get our local version of standard to match what the GH action pulls down.

rubocop (~> 0.89.1)
rubocop-performance (~> 1.7.1)
strong_password (0.0.8)
thor (0.20.3)
thread_safe (0.3.6)
Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function createGraphOptions(isStacked, stepSize, suggestedMax, tickCallbackFunct
padding: {
left: 0,
right: 0,
top: 48,
top: 20,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claudiovallejo here is the padding tweak

bottom: 0
}
},
Expand Down Expand Up @@ -235,7 +235,7 @@ function createGraphOptions(isStacked, stepSize, suggestedMax, tickCallbackFunct
maxRotation: 0,
minRotation: 0,
autoSkip: true,
maxTicksLimit: 10
maxTicksLimit: 10
}
}],
yAxes: [{
Expand Down Expand Up @@ -270,7 +270,7 @@ function createGraphOptions(isStacked, stepSize, suggestedMax, tickCallbackFunct
xPadding: 10,
yPadding: 10,
itemSort: function (a, b) {
return b.datasetIndex - a.datasetIndex;
return b.datasetIndex - a.datasetIndex;
},
callbacks: {
label: function (tooltipItem, data) {
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/partials/_reports.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
.pt-4px { padding-top: 4px; }
.pt-20px { padding-top: 20px; }
.pt-24px { padding-top: 24px; }
.pb-4px { padding-bottom: 4px; }
.pb-8px { padding-bottom: 8px; }
.pl-16px { padding-left: 16px; }
.px-1px { padding-right: 1px; padding-left: 1px; }
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/anonymized_data_download_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ class AnonymizedDataDownloadJob < ApplicationJob

def perform(recipient_name, recipient_email, model_params_map, model_type)
case model_type
when "district" then
when "district"
AnonymizedData::DownloadService.new.run_for_district(recipient_name,
recipient_email,
model_params_map[:district_name],
model_params_map[:organization_id])
when "facility" then
when "facility"
AnonymizedData::DownloadService.new.run_for_facility(recipient_name,
recipient_email,
model_params_map[:facility_id])
Expand Down
1 change: 1 addition & 0 deletions app/policies/cohort_report/facility_group_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/cohort_report/facility_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/cohort_report/organization_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/cohort_report/user_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/admin/facility_group_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/admin/facility_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/admin/organization_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/admin/user_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/facility/facility_group_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/facility/facility_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/facility/organization_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/facility_group_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/organization_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/protocol_drug_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/protocol_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/user/facility_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/manage/user/user_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/overdue_list/appointment_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/overdue_list/facility_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/overdue_list/patient_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
1 change: 1 addition & 0 deletions app/policies/overdue_list/patient_summary_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Scope < Scope
attr_reader :user, :scope

def initialize(user, scope)
super
@user = user
@scope = scope
end
Expand Down
4 changes: 2 additions & 2 deletions app/queries/my_facilities/missed_visits_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def total_registrations

def period_list(period, last_n)
case period
when :quarter then
when :quarter
last_n_quarters(n: last_n, inclusive: false)
when :month then
when :month
last_n_months(n: last_n, inclusive: false)
.map { |month| [month.year, month.month] }
end
Expand Down
6 changes: 3 additions & 3 deletions app/queries/my_facilities/registrations_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ def total_registrations

def period_list(period, last_n)
case period
when :quarter then
when :quarter
last_n_quarters(n: last_n, inclusive: true)
when :month then
when :month
last_n_months(n: last_n, inclusive: true)
.map { |month| [month.year, month.month] }
when :day then
when :day
last_n_days(n: last_n)
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/control_rate_service.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ControlRateService
CACHE_VERSION = 7
CACHE_VERSION = 8

# Can be initialized with _either_ a Period range or a single Period to calculate
# control rates. We need to handle a single period for calculating point in time benchmarks.
Expand Down
2 changes: 1 addition & 1 deletion app/services/region_report_service.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class RegionReportService
include SQLHelpers
MAX_MONTHS_OF_DATA = 24
CACHE_VERSION = 7
CACHE_VERSION = 8

def initialize(region:, period:, current_user:, top_region_benchmarks_enabled: false)
@current_user = current_user
Expand Down
2 changes: 1 addition & 1 deletion app/views/reports/regions/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<%= form_for(@period, url: request.params, method: :get, enforce_utf8: false) do |f| %>
<%= f.hidden_field :type, { id: "dropdown-period-type" } %>

<% (1..13).each do |num|
<% (1..6).each do |num|
selected = false
date = Date.current.beginning_of_month.advance(months: -num)
period = Period.new(type: :month, value: date)
Expand Down
Loading