Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: a97e818620
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (38 sloc) 1.842 kB
class GradesController < InstitutionsController
before_filter :require_professor, except: :index
before_filter :get_course_and_section, if: Proc.new {|p| p.params[:section_id]}
before_filter :get_event, only: [:edit, :update, :analysis]
before_filter :get_grade_fields, only: [:edit, :update]
ajax :analysis, :edit
def index
@title = "Gradebook#{within_section? ? " for #{@section.title}" : nil}"
@assignments = (current_user.is_a?(Professor) ? @section.events : @section.events.visible).assignments
@grades = Grade.scores_for(@assignments)
@student_grades = Grade.student_scores_for(current_user, @assignments) if current_user.is_a?(Student)
end
def trends
@title = "Grading Trends for #{@section.title}"
events = @section.events.assignments.all
@chart_1 = Chart.student_grades(@section, events)
@chart_2 = Chart.assignments_by_student(events)
@chart_3 = Chart.letter_grades(events, renderTo: 'graph_all_assignments', title: 'All Assignments By Letter Grade')
@chart_4 = Chart.grade_range(events, renderTo: 'graph_by_assignment', title: 'All Grades By Assignment', with_legend: true)
end
def analysis
@chart_1 = Chart.letter_grades(@event, renderTo: "assignment_#{@event.id}_analysis_chart_1")
@chart_2 = Chart.grade_range(@event, renderTo: "assignment_#{@event.id}_analysis_chart_2")
end
def update
respond_to do |format|
format.js { render action: "update_#{@event.update_attributes(params[:event]) ? 'success' : 'failure'}" }
end
end
protected
def get_grade_fields
@students = @section.students.order(:last_name, :first_name)
grades = @event.grades
@event_grades = @students.collect do |student|
grades.find {|grade| grade.student_id == student.id} || Grade.new(student_id: student.id)
end
end
end
Jump to Line
Something went wrong with that request. Please try again.