Skip to content

Commit

Permalink
Issue #476 Modifying the contest statistics methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahdi authored and Mahdi committed May 16, 2014
1 parent ef253f7 commit ef50d33
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tutor/app/controllers/students_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class StudentsController < ApplicationController
# @solved: [int] The number of solved problems
# @failed: [int] The number of failed problems
# @incomplete: [int] The number of incomplete problems
# @solved_contest: [int] The number of solved contest problems
# @failed_contest: [int] The number of failed contest problems
# Author: Mahdi
def get_performance
@solved = Attempt.where(student_id:params[:student_id], success:true).joins(problem: {track: :topic}).where('topics.course_id' => params[:course_id]).select("DISTINCT problem_id").count
Expand All @@ -18,6 +20,13 @@ def get_performance
@solved_contest = ContesProgress.where(student_id:params[:student_id], status:false).joins(:contest).where('contests.course_id' => params[:course_id]).select("DISTINCT cproblem_id").count
end

# [Performance of a student - Story 5.3]
# This method retrieve variables from tables in the database
# Parameters:
# params: A hash of the request URL attributes
# Returns:
# An array of registered courses by the student
# Author: Mahdi
def list_courses
@courses_list = CourseStudent.where(student_id: current_student.id)
end
Expand Down

0 comments on commit ef50d33

Please sign in to comment.