- content_for :after_title, ' - Usage Stats'
= hot_javascript_tag("charts")

%header.main-page
  .container
    %h1 Usage Stats
.container
  %section
    .section-header
      %h3
        = "Total users: #{@user_count}"
        %br
        = "OAuth users: #{@logged_in_count}"
        %br
        = "Unique program facilitators / course instructors: #{@course_instructor_count}"
        %br
        = "Unique project home wikis: #{@home_wiki_count}"
        %br
        = "Unique wikis interacted with: #{@total_wikis_touched}"
      %div.section-header
        Courses / Programs over time
        - i = 0
        - data = Course.all.map { |c| i += 1; [c.created_at, i.to_i] }
        = line_chart([{ name: 'count', data: data }], legend: false)

  %section
    .section-header
      Courses / Programs per wiki:
      - Wiki.all.order(:language, :project).each do |wiki|
        %li
          = "#{wiki.domain}: #{Course.where(home_wiki: wiki).count}"

  %section
    .section-header
      %a.button.dark{href: '/all_courses_csv'} Generate CSV of all programs

- content_for :after_title, ' - Usage Stats'
= hot_javascript_tag("charts")

%header.main-page
  .container
    %h1 Usage Stats
.container
  %section
    .section-header
      %h3
        = "Total users: #{@user_count}"
        %br
        = "OAuth users: #{@logged_in_count}"
        %br
        = "Unique program facilitators / course instructors: #{@course_instructor_count}"
        %br
        = "Unique project home wikis: #{@home_wiki_count}"
        %br
        = "Unique wikis interacted with: #{@total_wikis_touched}"
      %div.section-header
        Courses / Programs over time
        - i = 0
        - data = Course.all.order(:created_at).map { |c| i += 1; [c.created_at, i.to_i] }
        = line_chart([{ name: 'count', data: data }], legend: false)

  %section
    .section-header
      Courses / Programs per wiki:
      - Wiki.all.order(:language, :project).each do |wiki|
        %li
          = "#{wiki.domain}: #{Course.where(home_wiki: wiki).count}"

  %section
    .section-header
      %a.button.dark{href: '/all_courses_csv'} Generate CSV of all programs

Fix ordering of usage chart
Fix ordering of usage chart
