Ejemplo n.º 1
0
 def getClassPertile(self, exm):
     print_r('Grade method: getClassPertile')
     stdnts = db.get_students(self.grade, self.section)
     names = [s[1] for s in stdnts] 
     pertiles = [self.getExmPertile(s[0], exm) for s in stdnts]
     print_r('Grade method: getClassPertile-Complete')
     return names, pertiles
Ejemplo n.º 2
0
 def getSubjTotal(self, marks):
     print_r('Grade method: getSubjTotal')
     totals = []
     for i in range(0, len(marks), 2):
         totals.append(marks[i] + marks[i + 1])
     print_r('Grade method: getSubjTotal-Complete')
     return totals
 def getClassPercent(self, exm):
     print_r('Grade method: getClassPercent')
     stdnts = SQL.getStudents(self.grade, self.section)
     names = [s[1] for s in stdnts]
     percents = [self.getExmPercent(s[0], exm) for s in stdnts]
     print_r('Grade method: getClassPercent-Complete')
     return names, percents
Ejemplo n.º 4
0
 def calcPertile(self, marks, exam):
     print_r('Grade method: calcPertile')
     totals = self.getSubjTotal(marks)
     pertiles = []
     for i in range(len(totals)):
         maxMarks = getSubjBest(self.grade, self.section, exam, subjs[i])
         pertiles.append(round(totals[i] / maxMarks * 100, 2))
     print_r('Grade method: calcPertile-Complete')
     return pertiles
Ejemplo n.º 5
0
 def getExmPertile(self, uid, exam):
     print_r('Grade method: getExmPertile')
     if exam:
         return self.calcPertile(db.get_marks(uid, exam), exam)
     pertiles = []
     for exam in exams:
         maxMarks = getExmBest(self.grade, self.section, exam)
         total = sum(db.get_marks(uid, exam))
         pertiles.append(round(total / maxMarks * 100, 2))
     print_r('Grade method: getExmPertile-Complete')
     return pertiles
Ejemplo n.º 6
0
 def getClassPercent(self, exm, names=True):
     print_r('Grade method: getClassPercent')
     stud_names = None
     if names:
         stdnts = db.get_students(self.grade, self.section)
         stud_names = [s[1] for s in stdnts]
     else:
         stdnts = db.get_class_uid(self.grade, self.section)
     percents = [self.getExmPercent(s[0], exm) for s in stdnts]
     print_r('Grade method: getClassPercent-Complete')
     return stud_names, percents
Ejemplo n.º 7
0
 def calcPercent(self, marks, sa):
     print_r('Grade method: calcPercent')
     totals = self.getSubjTotal(marks)
     percents = []
     maxMarks = 50
     if sa:
         maxMarks = 100
         percents.append(round(totals.pop(0) / 125 * 100, 2))
     for score in totals:
         percents.append(round(score / maxMarks * 100, 2))
     print_r('Grade method: calcPercent-Complete')
     return percents
Ejemplo n.º 8
0
 def getExmPercent(self, uid, exam):
     print_r('Grade method: getExmPercent')
     if exam:
         sa = True if exam[0] == 'S' else False
         return self.calcPercent(db.get_marks(uid, exam), sa)
     percents = []
     for exam in exams:
         maxMarks = 300 if exam[0] == 'F' else 625
         total = sum(db.get_marks(uid, exam))
         percents.append(round(total / maxMarks * 100, 2))
     print_r('Grade method: getExmPercent-Complete')
     return percents
Ejemplo n.º 9
0
from libs.student import Student
from libs.db import DBFuncs
from libs.leaderboard import getLeaderboard, getExmTotal, getExmBest, getSubjBest
from libs.restrictIO import print_, print_r
print_r('File-grade.py Importing-Complete')
print_r('File-grade.py Starting Setup')
db = DBFuncs()

exams = ['FA1', 'FA2', 'SA1', 'FA3', 'FA4', 'SA2']
subjs = ['I_Lan', 'II_Lan', 'III_Lan', 'Maths', 'Science', 'Social']


class Grade:
    def __init__(self, grade, section):
        """
        Helps in making calculations on the marks of a whole class(ie. 10A, 10B)
        Calculations like getting the class best, class average etc which would
        be otherwise difficult to manage
        """
        print_('Grade method: __init__')
        self.section = section
        self.grade = grade

    def getStdntPosPercent(self, uid, exm):
        print_('Grade method: getStdntPosPercent')
        _, stud_pct = self.getClassPercent(exm, names=False)
        percents = []
        averages = []
        top = []
        bottom = []
        for i in range(len(stud_pct[0])):