<%= link_to data_vault_path, class: 'grey-text tooltipped', style: 'position: relative; top: 4px;', data: { position: 'bottom', enterDelay: '500', tooltip: "Back to your Data Vault" } do %> arrow_back <% end %> Document statistics

<%= number_with_delimiter @documents.sum { |doc| doc.cached_word_count || 0 } %>

total words written
<%= link_to documents_path do %>

<%= number_with_delimiter @documents.count %>

total documents
<% end %>

<%= number_with_delimiter @revisions.count %>

document versions
You've written <%= pluralize @documents.count, 'document' %> on Notebook.ai
<% @documents.each do |document| %> <% end %>
Title Word count History Analyzed?
<%= Document.icon %> <%= link_to document.title, document, class: "#{Document.text_color}" %> <%= number_with_delimiter(document.cached_word_count || 0) %> <%= 'word'.pluralize(document.cached_word_count || 0) %>
Created <%= time_ago_in_words document.created_at %> ago (<%= document.created_at.strftime("%m/%d/%Y") %>)
Last updated <% time_ago_in_words document.updated_at %> ago (<%= document.updated_at.strftime("%m/%d/%Y") %>)
<% if document.document_analysis.where.not(completed_at: nil).any? %> <%= link_to 'Yes', analysis_document_path(document), class: 'orange-text' %> <% else %> <%= link_to 'No', analysis_document_path(document) %> <% end %>
Writing activity over time

Notebook.ai automatically creates backups of your documents as often as every five minutes as you're writing. The following charts estimate approximately how much time you spend writing in Notebook.ai each day based on how many of those automatic backups were created.


<%= line_chart @revisions.where('created_at > ?', Date.current - 30.days).group_by_day(:created_at).map { |ts, c| [ts.split(' ').first, c * 5] }, title: "Last 30 days", ytitle: "minutes", colors: [Document.color], suffix: " minutes", download: true %>
<%= line_chart @revisions.group_by_day(:created_at).map { |ts, c| [ts.split(' ').first, c * 5] }, title: "All time", ytitle: "minutes", colors: [Document.color], suffix: " minutes", download: true %>
You have written something in a Notebook.ai document on <%= @revisions.group_by_day(:created_at).keys.count %> different days!
Words-written distribution per document
(for your 10 longest documents)
<%= pie_chart current_user.documents.where.not(cached_word_count: [0, nil]).order('cached_word_count DESC').limit(10).pluck(:title, :cached_word_count), suffix: ' words', legend: 'right', download: true %>
Words-written distribution per document
(for your 10 most recent documents)
<%= pie_chart current_user.documents.where.not(cached_word_count: [0, nil]).order('documents.updated_at DESC').limit(10).pluck(:title, :cached_word_count), suffix: ' words', legend: 'left', download: true %>
Revisions per document
<%= bar_chart @revisions_per_document_data, suffix: ' revisions', colors: [Document.color], download: true %>