def getStudentsByBatch(self, department, year_of_passing, course):
     try:
         list_students = [student for student in Student.select().where((Student.department == department) & (Student.batch_passing_year == year_of_passing) & (Student.course == course))]
     except:
         print("Exception occurred")
         traceback.print_exc()
         return []
     return list_students
Esempio n. 2
0
 def getAllStudents(self):
     try:
         list_students = [student for student in Student.select()]
     except Exception:
         print("Exception occurred.")
         traceback.print_exc()
         return None
     return list_students
 def getAllStudents(self):
     try:
         list_students = [student for student in Student.select()]
     except Exception:
         print("Exception occurred.")
         traceback.print_exc()
         return None
     return list_students
 def updateCGPAForAllStudents():
     for student in Student.select():
         cgpa = GPACalculator.calculateGpaForStudent(student)
         update_student = Student()
         update_student.roll = student.roll
         update_student.cgpa = cgpa
         studentDAO = StudentDAO()
         if(cgpa is not None):
             studentDAO.createOrUpdateModel(update_student)
Esempio n. 5
0
 def updateCGPAForAllStudents():
     for student in Student.select():
         cgpa = GPACalculator.calculateGpaForStudent(student)
         update_student = Student()
         update_student.roll = student.roll
         update_student.cgpa = cgpa
         studentDAO = StudentDAO()
         if (cgpa is not None):
             studentDAO.createOrUpdateModel(update_student)
Esempio n. 6
0
 def getStudentsByBatch(self, department, year_of_passing, course):
     try:
         list_students = [
             student for student in Student.select().where(
                 (Student.department == department)
                 & (Student.batch_passing_year == year_of_passing)
                 & (Student.course == course))
         ]
     except:
         print("Exception occurred")
         traceback.print_exc()
         return []
     return list_students
    dict_list = csv_reader.csvToDictionaryList(csv_read_filename)
    print(dict_list)
    for dict in dict_list:
        print(dict)
        studentDAO = StudentDAO()
        studentDAO.createOrUpdateModel(studentDAO.dictionaryToModel(dict))
        
        
# for student in Student.select():
#     cgpa = GPACalculator.calculateGpaForStudent(student)

#GPACalculator.updateCGPAForAllStudents()
# studentDAO = StudentDAO()
# list_students = studentDAO.getStudentsByBatch("CSE", "2016", "BE")#[student for student in Student.select()]
# list_students_2 = studentDAO.getStudentsByBatch("IT", "2016", "BE")
# list_students = list_students + list_students_2
# for student in list_students:
#     print(student.name, student.roll)

if(write_flag):
    studentDAO = StudentDAO()
    list_students = [student for student in Student.select().order_by(Student.course, Student.department, Student.batch_passing_year, Student.roll)]
    #print(list_students)
    csvDatabaseWriter = CsvDatabaseWriter(*fieldnames_write)
    print(fieldnames_write)
    list_students_dictionaries = [student.__dict__.get('_data') for student in list_students]
    #print(list_students_dictionaries)
    csvDatabaseWriter.dictionaryListToCsv(csv_write_filename, *list_students_dictionaries)


Esempio n. 8
0
        studentDAO = StudentDAO()
        studentDAO.createOrUpdateModel(studentDAO.dictionaryToModel(dict))

# for student in Student.select():
#     cgpa = GPACalculator.calculateGpaForStudent(student)

#GPACalculator.updateCGPAForAllStudents()
# studentDAO = StudentDAO()
# list_students = studentDAO.getStudentsByBatch("CSE", "2016", "BE")#[student for student in Student.select()]
# list_students_2 = studentDAO.getStudentsByBatch("IT", "2016", "BE")
# list_students = list_students + list_students_2
# for student in list_students:
#     print(student.name, student.roll)

if (write_flag):
    studentDAO = StudentDAO()
    list_students = [
        student for student in Student.select().order_by(
            Student.course, Student.department, Student.batch_passing_year,
            Student.roll)
    ]
    #print(list_students)
    csvDatabaseWriter = CsvDatabaseWriter(*fieldnames_write)
    print(fieldnames_write)
    list_students_dictionaries = [
        student.__dict__.get('_data') for student in list_students
    ]
    #print(list_students_dictionaries)
    csvDatabaseWriter.dictionaryListToCsv(csv_write_filename,
                                          *list_students_dictionaries)