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

Cohorts: Remove zeros, show appropriate number of columns #461

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
Don't show zeros in cohorts
Travis Giggy committed Jan 6, 2024

Verified

This commit was signed with the committer’s verified signature.
ararslan Alex Arslan
commit fa03f7f87f1d272c2fa63ed7ad43271b3ca1b7ad
2 changes: 1 addition & 1 deletion app/controllers/blazer/queries_controller.rb
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ def run
@run_id = blazer_params[:run_id]

run_cohort_analysis if @cohort_analysis

query_running = !@run_id.nil?

if query_running
7 changes: 4 additions & 3 deletions app/views/blazer/queries/_cohorts.html.erb
Original file line number Diff line number Diff line change
@@ -5,12 +5,13 @@
</p>
<% end %>
<% if @rows.any? %>
<% cohort_period_cols = @rows.map(&:length).max - 2 %>
<div class="results-container">
<table class="table results-table">
<thead>
<tr>
<th style="min-width: 100px;">Cohort</th>
<% 12.times do |i| %>
<% cohort_period_cols.times do |i| %>
<th style="width: 7.5%; text-align: right;"><%= @conversion_period.titleize %> <%= i + 1 %></th>
<% end %>
</tr>
@@ -22,10 +23,10 @@
<%= row[0] %>
<div style="font-size: 12px; color: #999;"><%= row[1] == 1 ? "1 user" : "#{number_with_delimiter(row[1])} users" %></div>
</td>
<% 12.times do |i| %>
<% cohort_period_cols.times do |i| %>
<td style="text-align: right;">
<% num = row[i + 2] %>
<% if num %>
<% if num && !num.zero? %>
<% denom = row[1] %>
<% if denom > 0 %>
<%= (100.0 * num / denom).round %>%