Example #1
0
class ScoreCard():
    def __init__(self):
        self.db_object = MongoConnection("localhost", 27017, 'mcq')
        self.table_name = 'scorecard'
        self.db_object.create_table(self.table_name, '_id')

    def get_score_card(self, useruid, exam_code):
        rankcard = self.db_object.get_all_vals(self.table_name, {
            'exam_code': exam_code,
            'useruid': useruid
        })
        return rankcard
Example #2
0
class Schedules():
    def __init__(self):
        self.db_object = MongoConnection("localhost", 27017, 'mcq')
        self.table_name = 'schedules'
        self.db_object.create_table(self.table_name, '_id')

    def get_upcoming_schedules(self):
        end_time = time.mktime(
            (datetime.date.today() + datetime.timedelta(30)).timetuple())
        start_time = time.mktime(datetime.date.today().timetuple())
        exams = self.db_object.get_all_vals(
            self.table_name, {
                'schedule_date': {
                    '$gte': int(start_time)
                },
                'schedule_date': {
                    '$lte': int(end_time)
                }
            })
        return exams
Example #3
0
class Exam():
    def __init__(self):
        self.db_object = MongoConnection("localhost", 27017, 'mcq')
        self.table_name = 'exammodel'
        self.db_object.create_table(self.table_name, '_id')

    def get_upcoming_exams(self):
        end_time = time.mktime(
            (datetime.date.today() + datetime.timedelta(7)).timetuple())
        start_time = time.mktime(datetime.date.today().timetuple())
        exams = self.db_object.get_all_vals(
            self.table_name, {
                'exam_date': {
                    '$gte': int(start_time)
                },
                'exam_date': {
                    '$lte': int(end_time)
                }
            })
        return exams

    def get_exam_detail(self, exam_code):
        return self.db_object.get_one(self.table_name,
                                      {'exam_code': exam_code})
Example #4
0
 def __init__(self):
     self.db_object = MongoConnection("localhost", 27017, 'mcq')
     self.table_name = 'schedules'
     self.db_object.create_table(self.table_name, '_id')