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

Add forward stat page #3812

Merged
merged 7 commits into from
Nov 6, 2018
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
33 changes: 18 additions & 15 deletions app/views/stats/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@

<p><%= raw t('notes.stats.looking_back', :time => @time.to_formatted_s(:long)) %></p>
<p>
<%= raw t('notes.stats.try_time_further_back', :url1 => "?time="+(@time-1.year).to_formatted_s(:long),
<%= raw t('notes.stats.try_time_further_back', :url1 => "?time="+(@time-1.year).to_formatted_s(:long),
:url2 => "?time="+(@time-1.month).to_formatted_s(:long), :url3 => "?time="+(@time-1.week).to_formatted_s(:long)) %>
</p>

<p>
<%= raw t('notes.stats.try_time_further_forward', :url1 => "?time="+(@time+1.year).to_formatted_s(:long),
:url2 => "?time="+(@time+1.month).to_formatted_s(:long), :url3 => "?time="+(@time+1.week).to_formatted_s(:long)) %>
</p>
<hr />

<h4>
Expand All @@ -44,9 +47,9 @@
<h4><%= raw t('notes.stats.research_notes_posted_by_contributors', :note_count => @all_notes, :contributors_count => @all_contributors,
:time => time_ago_in_words(Node.find_by(type: 'note', status: 1).created_at)) %></h4>
<h4><%= raw t('notes.stats.total_contributors', :all_contributors_count => @all_time_contributors) %></h4>

<p><%= raw t('notes.stats.notes_per_week_past_year', :note_count => @notes_per_week_past_year.round(2)) %></p>

<p><i><%= t('notes.stats.note_posting_52_weeks') %></i></p>

<div id="notes" style="border:1px solid #E5E5E5"></div>
Expand Down Expand Up @@ -82,7 +85,7 @@
divisions[2] = <%= @graph_comments %>

let months = ["J", "F", "M", "A", "M", "J", "J", "A","S", "O", "N", "D"];

let parents = new Array();
parents[0] = "#notes";
parents[1] = "#wikis";
Expand Down Expand Up @@ -123,10 +126,10 @@
count++;
}
let title = new Array();
title[0] = "notes";
title[1] = "wikis";
title[0] = "notes";
title[1] = "wikis";
title[2] = "comments";

let values = new Array();
for(i = 0; i < 3; i++){
let j = 0;
Expand All @@ -135,33 +138,33 @@
values[i][j] = divisions[i][j][1][1];
}
}

let datasets = new Array();
for(i = 0; i < 3; i++){
datasets[i] = new Array();
obj = new Object();
obj = new Object();
obj.title = title[i];
obj.values = new Array();
obj.values = values[i];
datasets[i][0] = new Object();
datasets[i][0] = obj;
}

let data = new Array();
for(i = 0; i < 3; i++){
data[i] = new Object();
data[i].labels = labels;
data[i].datasets = datasets[i];
}

for(i = 0; i < 3; i++){
let lineGraph = new Chart({
parent: parents[i],
type: "bar",
parent: parents[i],
type: "bar",
show_dots: 0,
heatline: 1,
height: 115,
region_fill: 0,
region_fill: 0,
data: data[i],
x_axis_mode: "tick",
y_axis_mode: "span",
Expand Down
38 changes: 38 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,41 @@ en:
month: Month
second: Seconds
year: Year
notes:
stats:
about_this_page: |
<h4>About this page</h4>

<p>Public Lab is built on the contributions of community members, and this website represents our collective open source work.</p>
contributors_statistics: "Contributor statistics"
looking_back: "Looking back from <i>%{time}</i>."
try_time_further_back: |
Try
<a href='%{url1}'>one year</a>,
<a href='%{url2}'>one month</a>, or
<a href='%{url3}'>one week</a>
further back.
try_time_further_forward: |
Or try
<a href='%{url1}'>one year</a>,
<a href='%{url2}'>one month</a>, or
<a href='%{url3}'>one week</a>
further forward.
notes_and_wiki_edits_past_week: |
<a href='%{url1}'>%{note_count} notes</a>
and <a href='%{url2}'>%{wiki_count} wiki edits</a> posted in the past week.
people_joined_past_week: "<b>%{people_count} people</b> joined in the past week."
notes_and_wiki_edits_past_month: |
<a href='%{url1}'>%{note_count} notes</a>
and <a href='%{url2}'>%{wiki_count} wiki edits</a> posted in the past month.
people_joined_past_month: "<b>%{people_count} people</b> joined in the past month."
research_notes_posted_by_contributors: "%{note_count} research notes have been posted by %{contributors_count} contributors since %{time} ago"
total_contributors: "%{all_contributors_count} Total Contributors (Tallied weekly)"
notes_per_week_past_year: "%{note_count} notes per week over the past year."
note_posting_52_weeks: "Note posting for the past 52 weeks:"
wiki_pages_posted: "%{count} wiki pages have been posted, total"
wiki_page_posting_52_weeks: "Wiki page posting for the past 52 weeks:"
comments_posted: "%{count} comments have been posted, total"
comments_posted_52_weeks: "Comments posted for the past 52 weeks:"
wiki_page_edits: "%{count} wiki page edits have been made, total"
edits_per_week: "%{count} edits per week over the past year."
35 changes: 0 additions & 35 deletions config/locales/views/notes/stats/en.yml

This file was deleted.