Ejemplo n.º 1
0
def gen_award(db, user_id, team_id=None, name="award_name", value=100):
    award = Awards(user_id=user_id, team_id=team_id, name=name, value=value)
    award.date = datetime.datetime.utcnow()
    db.session.add(award)
    db.session.commit()
    clear_standings()
    return award
Ejemplo n.º 2
0
                    new_base = random_date(base_time, base_time + datetime.timedelta(minutes=random.randint(30, 60)))
                    solve.date = new_base
                    base_time = new_base

                    db.session.add(solve)

        db.session.commit()

        # Generating Awards
        print("GENERATING AWARDS")
        for x in range(USER_AMOUNT):
            base_time = datetime.datetime.utcnow() + datetime.timedelta(minutes=-10000)
            for _ in range(random.randint(0, AWARDS_AMOUNT)):
                award = Awards(x + 1, gen_word(), random.randint(-10, 10))
                new_base = random_date(base_time, base_time + datetime.timedelta(minutes=random.randint(30, 60)))
                award.date = new_base
                base_time = new_base

                db.session.add(award)

        db.session.commit()

        # Generating Wrong Keys
        print("GENERATING WRONG KEYS")
        for x in range(USER_AMOUNT):
            used = []
            base_time = datetime.datetime.utcnow() + datetime.timedelta(minutes=-10000)
            for y in range(random.randint(1, CHAL_AMOUNT * 20)):
                chalid = random.randint(1, CHAL_AMOUNT)
                if chalid not in used:
                    used.append(chalid)
Ejemplo n.º 3
0
                    new_base = random_date(base_time, base_time + datetime.timedelta(minutes=random.randint(30, 60)))
                    solve.date = new_base
                    base_time = new_base

                    db.session.add(solve)

        db.session.commit()

        # Generating Awards
        print("GENERATING AWARDS")
        for x in range(USER_AMOUNT):
            base_time = datetime.datetime.utcnow() + datetime.timedelta(minutes=-10000)
            for _ in range(random.randint(0, AWARDS_AMOUNT)):
                award = Awards(x + 1, gen_word(), random.randint(-10, 10))
                new_base = random_date(base_time, base_time + datetime.timedelta(minutes=random.randint(30, 60)))
                award.date = new_base
                base_time = new_base

                db.session.add(award)

        db.session.commit()

        # Generating Wrong Keys
        print("GENERATING WRONG KEYS")
        for x in range(USER_AMOUNT):
            used = []
            base_time = datetime.datetime.utcnow() + datetime.timedelta(minutes=-10000)
            for y in range(random.randint(1, CHAL_AMOUNT * 20)):
                chalid = random.randint(1, CHAL_AMOUNT)
                if chalid not in used:
                    used.append(chalid)