class StudentassignmentsController < ApplicationController

  # GET /igrades/1
  # GET /igrades/1.xml
  def summary
    # WE GET HERE BY A "summary" LINK FROM THE LIST OF STUDENTS, SO WE HAVE
    # THE STUDENT ID FOR WHICH A SUMMARY IS REQUESTED. WE GET ALL THE 
    # INDIVIDUAL GRADES PER STUDENT AND IF THE STUDENT IS IN A GROUP WE GET
    # ALSO THE GROUP GRADES.
    @studentx= params[:id]
    @igrades = Igrade.find(:all, :conditions => "student_id = #{@studentx}" )
    group = Student.find(:first, :select => "students.groupnum", 
  	                     :conditions => "id = #{@studentx} " ).groupnum
  	if group > 0
  	  @ggrades = Ggrade.find(:all, :conditions => "groupnum = #{group}" )
  	end                          

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @igrades }
    end
  end
end

