def build_faculty_timeline_series(self):
        """
        get faculty object
        get cfs objects from faculty
        get dates from feedback using cfs = relation
        1. get all the timelines of the faculty
        2. for each timeline, get all the ratings
        :return:
        """
        series = Series('Timeline', 'timeline', self)

        timelines = db_helper.get_all_timelines(self.faculty)

        bars = []

        for timeline in timelines:
            bars.append(
                Bar(
                    timeline.date.strftime('%d-%b-%Y'),
                    timeline.rating,
                    'null'
                )
            )

        series.bars = bars
        series.color_by_point = 'false'
        return series
    def build_section_series(self, year, branch):
        series = Series(year + ' ' + branch, year + ' ' + branch, self)
        sections = db_helper.get_sections(year, branch)
        bars = []

        for i in range(len(sections)):
            bars.append(Bar(
                sections[i],
                db_helper.get_section_value(year, branch, sections[i]),
                self.build_faculty_series(year, branch, sections[i])
            ))

        series.bars = bars
        return series.rev_sort()
    def build_class_branch_series(self, year):
        series = Series(year, year, self)
        branches = db_helper.get_branches(year)
        bars = []

        for i in range(len(branches)):
            bars.append(
                Bar(
                    branches[i],
                    db_helper.get_branch_value(year, branches[i]),
                    self.build_section_series(year, branches[i])
                )
            )
        series.bars = bars
        return series.rev_sort()
    def build_faculty_for_subject_series(self, subject):
        faculty = db_helper.get_faculty_for_subject(subject)

        bars = []
        series = Series(subject, subject, self)

        for i in range(len(faculty)):
            bars.append(Bar(
                faculty[i].name,
                db_helper.get_faculty_value_for_subject(subject, faculty[i]),
                'null'
            ))

        series.bars = bars
        return series.rev_sort()
Example #5
0
    def build_faculty_ques_series(self, cfs):
        questions = db_helper.get_selected_questions()

        bars = []
        series = Series(str(cfs), str(cfs), self)

        for question in questions:
            bars.append(Bar(
                question.question,
                db_helper.get_question_value_for_cfs(cfs.cfs_id, question.question_id),
                'null'
            ))

        series.bars = bars
        return series.rev_sort()
Example #6
0
    def build_class_branch_series(self, year):
        series = Series(year, year, self)
        branches = LOAdb_helper.get_branches(year)
        bars = []

        for i in range(len(branches)):
            bars.append(
                Bar(
                    branches[i],  # name of the branch
                    LOAdb_helper.get_branch_value(
                        year, branches[i]),  # value of the branch
                    self.build_section_series(
                        year, branches[i])  #drilldown to sections
                ))
        series.bars = bars
        return series
 def build_faculty_series(self, year, branch, section):
     series = Series(year + ' ' + branch + ' ' + section, year + ' ' + branch + ' ' + section, self)
     faculty = db_helper.get_faculty(year, branch, section)
     bars = []
     for i in range(len(faculty)):
         cfss = db_helper.get_cfs(faculty[i].name, year, branch, section)
         for cfs in cfss:
             bars.append(Bar(
                 faculty[i].name + ' (' + cfs.subject_id.name + ')',
                 db_helper.get_cfs_value(cfs),
                 self.build_faculty_ques_series(faculty[i].name)
                 # TODO: build cfs series
                 # 'null'
             ))
     series.bars = bars
     return series.rev_sort()
Example #8
0
    def build_sections_for_subject_series(
            self, subject):  # sections in subjects graph
        sections = LOAdb_helper.get_feedback_sections_subject(subject)

        bars = []
        series = Series(subject, subject, self)

        for i in range(len(sections)):
            bars.append(
                Bar(
                    sections[i],  # my code
                    LOAdb_helper.get_subject_value_for(subject, sections[i]),
                    'null'
                    # TODO: add questions series
                ))

        series.bars = bars
        return series
Example #9
0
    def get_all_subject_values(self, year, branch, section):  # my code
        series = Series(year + ' ' + branch + ' ' + section,
                        year + ' ' + branch + ' ' + section, self)
        class_id = Classes.objects.get(year=deformatter[year],
                                       branch=branch,
                                       section=section)

        subject = LOAdb_helper.get_subjects(year, branch)
        bars = []
        for i in range(len(subject)):
            bars.append(
                Bar(
                    subject[i],
                    LOAdb_helper.get_subject_value_for(subject[i], class_id),
                    # this is the one i should take care
                    'null'))
        series.bars = bars
        return series
Example #10
0
    def build_section_series(self, year, branch):
        series = Series(year + ' ' + branch, year + ' ' + branch, self)
        sections = LOAdb_helper.get_sections(year, branch)
        bars = []

        for i in range(len(sections)):
            bars.append(
                Bar(
                    sections[i],  # section name
                    LOAdb_helper.get_section_value(
                        year, branch, sections[i]),  # section value
                    self.get_all_subject_values(year, branch,
                                                sections[i])  #my code
                    #'null'
                ))

        series.bars = bars
        return series
Example #11
0
    def build_all_subjects_series(self):  # subject graphs
        subjects = LOAdb_helper.get_subjects_in_feedback()

        if self.type == Graphable.types[1]:
            self.height = len(subjects) * Graphable.height_per_bar

        bars = []
        title = 'All Subjects'
        series = Series(title, title, self)

        for i in range(len(subjects)):
            bars.append(
                Bar(subjects[i], LOAdb_helper.get_subject_value(subjects[i]),
                    self.build_sections_for_subject_series(subjects[i])
                    # 'null'
                    ))

        series.bars = bars
        return series
    def build_faculty_ques_series(self, faculty):
        questions = db_helper.get_selected_questions()

        if self.type == Graphable.types[1]:
            if self.height < len(questions) * Graph.height_per_bar:
                self.height = len(questions) * Graph.height_per_bar

        bars = []
        series = Series(faculty, faculty, self)

        for question in questions:
            bars.append(Bar(
                question.question,
                db_helper.get_question_value(faculty, question.question_id),
                'null'
            ))

        series.bars = bars
        return series.rev_sort()
Example #13
0
    def build_faculty_series(self):
        cfs = db_helper.get_faculty_cfs(self.faculty)

        if self.type == Graphable.types[1]:
            if self.height < len(cfs) * self.height_per_bar:
                self.height = len(cfs) * self.height_per_bar

        bars = []
        series = Series('Classes', 'class-sub', self)

        for i in range(len(cfs)):
            bars.append(Bar(
                str(cfs[i].class_id) + ' ( ' + cfs[i].subject_id.name + ' )',
                db_helper.get_cfs_value(cfs[i]),
                self.build_faculty_ques_series(cfs[i])
            ))

        series.bars = bars
        return series.rev_sort()
    def build_all_subjects_series(self):
        subjects = db_helper.get_all_subjects_all_years()

        if self.type == Graph.types[1]:
            self.height = len(subjects) * Graph.height_per_bar

        bars = []
        title = 'All Subjects'
        series = Series(title, title, self)

        for i in range(len(subjects)):
            bars.append(Bar(
                subjects[i],
                db_helper.get_subject_value(subjects[i]),
                self.build_faculty_for_subject_series(subjects[i])
            ))

        series.bars = bars
        return series.rev_sort()
Example #15
0
    def build_faculty_ques_series(self):
        questions = db_helper.get_selected_questions()

        bars = []
        series = Series(self.faculty, self.faculty, self)

        for question in questions:
            bars.append(
                Bar(
                    question.question,
                    db_helper.get_question_value(self.faculty,
                                                 question.question_id),
                    'null'))

        if self.type == 'bar':
            self.height = math.sqrt(len(bars)) * 5 * self.height_per_bar

        series.bars = bars
        series.color_by_point = 'false'
        return series.rev_sort()
Example #16
0
    def get_series(self):  # arey, till this method get_series, I'll
        itr = 0
        series = None
        title = 'Title'

        if self.category == 'class' or self.category == '':
            if len(self.year) == 0:
                # By Class table
                title = 'All Years'
                series = Series(title, 'all_years', self)
                series.bars = self.get_all_years_bars()
                itr = 1
            elif self.year == 'all_branches':
                # By Class all years all branches
                title = 'All Years, Branches'
                if self.type == 'null': self.type = Graphable.types[1]
                series = Series(title, 'all_branches', self)
                series.bars = self.get_all_branches_bars()
                itr = 2
            elif self.year == 'all_sections':
                # By Class all years all branches all sections
                title = 'All Years, Branches, Sections'
                if self.type == 'null': self.type = Graphable.types[1]
                series = Series(title, 'all_sections', self)
                series.bars = self.get_all_sections_bars()
                itr = 3

        elif self.category == 'subject':
            if len(self.branch) == 0:
                # All subjects table
                title = 'All Subjects'
                if self.type == 'null': self.type = Graphable.types[1]
                series = self.build_all_subjects_series()
                itr = 6
            else:
                # Selected subject graph - year, branch
                title = self.year + '-' + self.branch
                series = Series(title, title, self)
                itr = 7
        self.s_no = itr
        self.title = title

        return series
    def get_series(self):
        itr = 0
        series = None
        title = 'Title'

        if self.category == 'fac' or self.category == '':
            if len(self.subsub) == 0:
                # By Faculty table
                title = 'All Faculty'
                if self.type == 'null': self.type = Graph.types[1]
                series = Series(title, 'all_faculty', self)
                series.bars = self.get_all_faculty_bars()
                itr = 4
            else:
                # selected faculty - subsub
                faculty_name = db_helper.get_faculty_name(self.subsub)
                title = faculty_name
                if self.type == 'null': self.type = Graph.types[1]
                series = self.build_faculty_ques_series(faculty_name)
                itr = 5

        elif self.category == 'class':
            if len(self.year) == 0:
                # By Class table
                title = 'All Years'
                series = Series(title, 'all_years', self)
                series.bars = self.get_all_years_bars()
                itr = 1
            elif self.year == 'all_branches':
                # By Class all years all branches
                title = 'All Years, Branches'
                if self.type == 'null': self.type = Graph.types[1]
                series = Series(title, 'all_branches', self)
                series.bars = self.get_all_branches_bars()
                itr = 2
            elif self.year == 'all_sections':
                # By Class all years all branches all sections
                title = 'All Years, Branches, Sections'
                if self.type == 'null': self.type = Graph.types[1]
                series = Series(title, 'all_sections', self)
                series.bars = self.get_all_sections_bars()
                itr = 3

        elif self.category == 'stu':
            if len(self.branch) == 0:
                # All subjects table
                title = 'All Subjects'
                if self.type == 'null': self.type = Graph.types[1]
                series = self.build_all_subjects_series()
                itr = 6
            else:
                # Selected subject graph - year, branch
                title = self.year + '-' + self.branch
                series = Series(title, title, self)
                # TODO: build subject series?
                itr = 7
        self.s_no = itr
        self.title = title

        return series.rev_sort()