<% # Copyright (C) 2011 - present Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see . %> <% set_active_tab 'settings' css_bundle :statistics add_crumb t('#crumbs.stats', "Statistics") %> <% provide :page_title, join_title(t(:page_title, "Course Statistics"), @context.name) %>

<%= t 'Statistics for %{course}', :course => @context.name %>

<% active_students = @context.participating_students.where("enrollments.type<>'StudentViewEnrollment'").distinct.count %> <% inactive_students = @context.student_enrollments.invited_by_date.distinct.count(:user_id) %> <% active_topics = @context.discussion_topics.active.pluck(:id) %> <% total_topics = active_topics.length %> <% active_assignments = @context.assignments.active assignment_counts_by_type = active_assignments.group(:submission_types).except(:order).count assignment_counts = assignment_counts_by_type.inject(Hash.new(0)) do |counts, (types, count)| split_types = (types || '').split(',') if split_types.length == 1 counts[types] += count else split_types.each { |type| counts[type] += count } end counts end %> <% total_entries = DiscussionEntry.active.where(:discussion_topic_id => active_topics).count %> <% total_assignments = active_assignments.select(&:expects_submission?).length %> <% submission_counts = @context.submissions.having_submission.group(:submission_type).except(:order).count %> <% total_submissions = submission_counts.values.sum %> <% rubric_associations = @context.rubric_associations.bookmarked.distinct.pluck(:rubric_id) %>
<% js_bundle :course_statistics %>