-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dashboard now displays a randomization overview, addresses #19.
- Loading branch information
1 parent
1a16119
commit 4576d37
Showing
7 changed files
with
79 additions
and
14 deletions.
There are no files selected for viewing
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
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
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
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,8 @@ | ||
- first_row = report.report_rows.first | ||
- if first_row | ||
.mb-3 | ||
%strong | ||
This month | ||
%p | ||
= pluralize(first_row.result.count, "subject") | ||
randomized this month. |
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,32 @@ | ||
- if report.header | ||
- site_map = {} | ||
- report.header.select{ |h| h.key?("id") }.each do |hash| | ||
- site_map[hash["id"].to_s] = hash["label"] | ||
- counts = {} | ||
- report.report_rows.each do |report_row| | ||
- result = report_row.result || {} | ||
- (result["sites"] || []).each_with_index do |hash, index| | ||
- if hash["site_id"] | ||
- counts[site_map[hash["site_id"].to_s]] ||= 0 | ||
- counts[site_map[hash["site_id"].to_s]] += hash["count"].to_i | ||
|
||
- max_count = counts.values.max | ||
- sites = counts.select { |_, v| v == max_count }.collect { |k, _| k } | ||
|
||
- if sites.present? | ||
.mb-3 | ||
%strong | ||
Top | ||
= "site".pluralize(sites.count) | ||
|
||
%p | ||
= sites.collect{ |site| content_tag(:span, site, class: "nowrap text-primary") }.to_sentence.html_safe | ||
- if sites.size > 1 | ||
lead | ||
- else | ||
leads | ||
with | ||
= succeed "." do | ||
%strong= pluralize(max_count, "total randomization") | ||
- if sites.size > 1 | ||
each |
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,5 @@ | ||
.mb-3 | ||
%strong | ||
Total randomizations | ||
%div{ style: "font-size: 2rem;font-weight: 300;" }= report.total_count | ||
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,8 @@ | ||
- page = report.pages.where(archived: false).first | ||
- if page | ||
.mb-3 | ||
= icon("fas", "chart-area") | ||
View | ||
= link_to report_page_path(page) do | ||
= page.name | ||
= icon("fas", "caret-right") |