Example #1
0
    /**
     * Sorting functions.s
     */
    private void SortStudentsByDimension(List <Student> students, Score.Dimension dim)
    {
        switch (dim)
        {
        case Score.Dimension.IA:
            students.Sort(CompareStudentsByDimension_IA);
            break;

        case Score.Dimension.GA:
            students.Sort(CompareStudentsByDimension_GA);
            break;

        case Score.Dimension.SCIC:
            students.Sort(CompareStudentsByDimension_SCIC);
            break;

        case Score.Dimension.PPE:
            students.Sort(CompareStudentsByDimension_PPE);
            break;

        case Score.Dimension.WB:
            students.Sort(CompareStudentsByDimension_WB);
            break;
        }
    }
Example #2
0
 /**
  * Displays the name and score of a given student across a given dimension.
  */
 public void SetForStudent(Student student, Score.Dimension dimension)
 {
     if (student != null)
     {
         SetVisibility(true);
         id = student.huskyID;
         studentName.text = student.student_name;
         score.text       = student.score.GetScoreForDimension(dimension) + "";
     }
     else
     {
         SetVisibility(false);
     }
 }
Example #3
0
    /**************************************
     * Comparators.
     *************************************/
    private static int CompareStudentsByDimension(Student x, Student y, Score.Dimension dim)
    {
        int xScore = x != null?x.score.GetScoreForDimension(dim) : 0;

        int yScore = y != null?y.score.GetScoreForDimension(dim) : 0;

        if (xScore < yScore)
        {
            return(1);
        }
        else if (xScore == yScore)
        {
            return(0);
        }
        else
        {
            return(-1);
        }
    }
Example #4
0
    /**
     * Sets up the current ranking list based on a provided dimension.
     */
    public void SetupForDimension(Score.Dimension dimension)
    {
        // Retrieves and sorts the current user's friends
        List <Student> students = GenerateRankingsList();

        SortStudentsByDimension(students, dimension);

        // Sets students for visibility
        for (int i = 0; i < NUM_RANKS_SHOWN; i++)
        {
            if (i < students.Count && students[i] != null)
            {
                studentRanks[i].SetForStudent(students[i], dimension);
            }
            else
            {
                studentRanks[i].SetVisibility(false);
            }
        }
    }