Example #1
0
def main():
    """Checks for modified grades and updates the database"""
    config.config_storer()

    db_conn = sqlite3.connect(vmcheckerpaths.db_file(),
                              isolation_level="EXCLUSIVE")
    db_cursor = db_conn.cursor()

    def _update_grades_wrapper(assignment, user, location, db_cursor):
        """A wrapper over _update_grades to use with repo_walker"""
        assignment_id = _db_get_assignment_id(db_cursor, assignment)
        user_id = _db_get_user_id(db_cursor, user)

        grade_filename = os.path.join(location, vmcheckerpaths.GRADE_FILENAME)
        if os.path.exists(grade_filename):
            _update_grades(assignment_id, user_id, grade_filename, db_cursor)
            _logger.info('Updated %s, %s (%s)', assignment, user, location)
        else:
            _logger.error('No results found for %s, %s (check %s)',
                          assignment, user, grade_filename)

    repo_walker.walk(_update_grades_wrapper, args=(db_cursor,))

    db_cursor.close()
    db_conn.commit()
    db_conn.close()
Example #2
0
def create_db():
    """Create the implicit db if it does not exist."""
    # check for DB existance
    db_file = vmcheckerpaths.db_file()
    if not os.path.isfile(db_file):
        create_db_tables(db_file)
    else:
        _logger.info('Skipping existing Sqlite3 DB file %s' % db_file)
Example #3
0
def main():
    config.config_storer()

    global db_cursor
    db_conn = sqlite3.connect(vmcheckerpaths.db_file())
    db_cursor = db_conn.cursor()

    (results, hws) = get_db_content()
    # send to the stdout all the HTML content
    print gen_html(results, hws)
    db_cursor.close()
    db_conn.close()

    print """
Example #4
0
def main():
    """Reads grades and generates the HTML table"""
    config.config_storer()

    db_conn = sqlite3.connect(vmcheckerpaths.db_file())
    db_cursor = db_conn.cursor()

    results = _db_retrieve_grades(db_cursor)
    assignments = sorted(config.assignments)

    # sends to the stdout all the HTML content
    print _generate_html(results, assignments)
    print _powered_by_vmchecker()

    db_cursor.close()
    db_conn.close()