def run(hours):
    print 'Starting OppiaMobile cron...'
    now = time.time()
    path = settings.COURSE_UPLOAD_DIR + "temp"
    print 'Cleaning up: ' + path
    for f in os.listdir(path):
        f = os.path.join(path, f)
        if os.stat(f).st_mtime < now - 3600*6:
            print f
            if os.path.isfile(f):
                os.remove(f)
         
    courses_completed(int(hours))           
    print 'cron completed'
Esempio n. 2
0
def run(hours):
    print 'Starting OppiaMobile cron...'
    now = time.time()
    path = settings.COURSE_UPLOAD_DIR + "temp"
    print 'Cleaning up: ' + path
    for f in os.listdir(path):
        f = os.path.join(path, f)
        if os.stat(f).st_mtime < now - 3600 * 6:
            print f
            if os.path.isfile(f):
                os.remove(f)

    courses_completed(hours)
    print 'cron completed'
Esempio n. 3
0
def run():
    print "Starting OppiaMobile cron..."
    now = time.time()
    path = settings.COURSE_UPLOAD_DIR + "temp"
    print "Cleaning up: " + path
    for f in os.listdir(path):
        f = os.path.join(path, f)
        if os.stat(f).st_mtime < now - 3600 * 6:
            print f
            if os.path.isfile(f):
                os.remove(f)

    print "Awarding badges..."
    created_quizzes(10)
    courses_completed()
    print "cron completed"
Esempio n. 4
0
def run(hours):
    print 'Starting OppiaMobile cron...'
    now = time.time()
    path = settings.COURSE_UPLOAD_DIR + "temp"

    if os.path.exists(path):
        print 'Cleaning up: ' + path
        for f in os.listdir(path):
            f = os.path.join(path, f)
            if os.stat(f).st_mtime < now - 3600*6:
                print f
                if os.path.isfile(f):
                    os.remove(f)
    else:
        print '{path} does not exist. Don\'t need to clean it'.format(path=path)

    courses_completed(int(hours))           
    print 'cron completed'
Esempio n. 5
0
def run(hours):
    print('Starting OppiaMobile cron...')
    now = time.time()
    path = settings.COURSE_UPLOAD_DIR + "temp"

    if os.path.exists(path):
        print('Cleaning up: ' + path)
        for f in os.listdir(path):
            f = os.path.join(path, f)
            if os.stat(f).st_mtime < now - 3600 * 6:
                print(f)
                if os.path.isfile(f):
                    os.remove(f)
    else:
        print('{path} does not exist. Don\'t need to clean it'.format(path=path))

    from awards import courses_completed
    courses_completed(int(hours))

    # create and new media images
    call_command('generate_media_images')

    print('cron completed')
Esempio n. 6
0
def run(hours):
    print('Starting OppiaMobile cron...')
    now = time.time()
    path = settings.COURSE_UPLOAD_DIR + "temp"

    if os.path.exists(path):
        print('Cleaning up: ' + path)
        for f in os.listdir(path):
            f = os.path.join(path, f)
            if os.stat(f).st_mtime < now - 3600 * 6:
                print(f)
                if os.path.isfile(f):
                    os.remove(f)
    else:
        print(
            '{path} does not exist. Don\'t need to clean it'.format(path=path))

    from awards import courses_completed
    courses_completed(int(hours))

    # create and new media images
    call_command('generate_media_images')

    print('cron completed')