####################################################################################################################################################  
#                                                                                                                                                  #
# This file has been generated by Amit Patankar:                                                                                                   #
#     Created by              : amit.patankar                                                                                                      #    
#     Created on              : 11-07-2013                                                                                                         #
#     Directory               : /Desktop/                                                                                                          #
#     Purpose                 : This structure represents data parsed statistics of a test.                                                        #
#                                                                                                                                                  #
#################################################################################################################################################### 

from Values import *

class Test_Stats(object):

    #Creates a test statistics module.
    def __init__(self, scored_test):
        self.test_id = scored_test.test_id

class Section_Stats(object):

    #Creates a section statistics module.
    def __init__(self, test, scored_section):
        self.test_stats = test
        self.index = scored_section.index
        self.type = scored_section.type
        self.scored_section = scored_section
        self.questions = {}

        with open(self.test_stats.get_id() + DIR_SEP + "Section " + str(self.index) + CSV, 'rU') as f:
            reader = csv.reader(f)
            for row in reader:
                question_index = row[NUMBER_INDEX]
                difficulty = row[DIFFICULTY_INDEX]
                question_type = row[TYPE_INDEX]
                self.questions[question_index] = (difficulty, question_type)


    #This returns the scored section id.
    def get_id(self):
        return self.scored_test.get_id() + FIELD_SEP + str(self.index)
        