Esempio n. 1
0
    def get_data(self,students,get_all=True, year=-1): 
        """Returns list of students with student data information"""
        
        print 'From year:', (str(year)+'-'+str(year+1)) 
        print 'From title:',self.s.title
        # Check if year is requested year
        if year != -1 and (str(year)+'-'+str(year+1)) != self.s.title: 
            return

        for row in range(self.header_row+1,self.s.get_highest_row()+1):
            rowID = 0
            val1 = self.s.cell(row=row,column=self.id_column).value
            if self.s.cell(row=row,column=self.id_column).data_type == 's':
                # remove hyphens
                val1 = val1.replace('-','')
                rowID = atoi(val1)
            else:
                rowID = int(val1)
            
            student = find_by_id(students,rowID)
            if student is None:
                if get_all:
                    student = Student()
                    students.append(student)
                else:
                    continue
            
            # Get ID and year
            student.stuID    = rowID
            student.gradYear = int(self.s.cell(row=row,column=self.gradYear_column).value)
            # Get Name
            student.last   = str(self.s.cell(row=row,column=self.last_column).value)
            student.first  = str(self.s.cell(row=row,column=self.first_column).value)
            # Get Address
            student.street  = str(self.s.cell(row=row,column=self.street_column).value)
            student.city    = str(self.s.cell(row=row,column=self.city_column).value)
            student.state   = str(self.s.cell(row=row,column=self.state_column).value)
            student.zipcode = str(self.s.cell(row=row,column=self.zipcode_column).value)
            # DOB
            if str(self.s.cell(row=row,column=self.dob_column).value) == "None":
                student.dob = ""
            else:
                time_tuple  = time.strptime(str(self.s.cell(row=row,column=self.dob_column).value),"%Y-%m-%d %H:%M:%S")
                student.dob = str(time_tuple.tm_mon)+"/"+str(time_tuple.tm_mday)+"/"+str(time_tuple.tm_year)
			# Get IEP/504/ELL
            student.HasIEP   = (str(self.s.cell(row=row,column=self.iep_column).value) == 'IEP')
            student.Has504   = (str(self.s.cell(row=row,column=self.p504_column).value) == '504 Plan')
            student.IsELL   = (str(self.s.cell(row=row,column=self.ell_column).value) == 'ELL')