Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions spamdb/modules/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ def parse_args() -> argparse.Namespace:
streamers. by default no streamers are created.
""",
)
parser.add_argument(
"--coaches",
action="store_true",
help="""
if --coaches is present then 10% of users created will also be coaches, by default no coaches are created.
""",
)
parser.add_argument(
"--follow",
type=float,
Expand Down
32 changes: 32 additions & 0 deletions spamdb/modules/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def update_user_colls() -> None:
users: list[User] = []
patrons: list[Patron] = []
streamers: list[Streamer] = []
coaches: list[Coach] = []
rankings: list[perf.Ranking] = []
perfstats: list[perf.PerfStat] = []
userperfs: list[perf.UserPerfs] = []
Expand All @@ -52,6 +53,8 @@ def update_user_colls() -> None:
patrons.append(Patron(u._id))
if args.streamers and util.chance(0.2):
streamers.append(Streamer(u))
if args.coaches and util.chance(0.1):
coaches.append(Coach(u))

users.extend(_create_special_users())

Expand All @@ -62,6 +65,7 @@ def update_user_colls() -> None:
util.bulk_write(db.user4, users)
util.bulk_write(db.plan_patron, patrons)
util.bulk_write(db.streamer, streamers)
util.bulk_write(db.coach, coaches)
util.bulk_write(db.ranking, rankings)
util.bulk_write(db.perf_stat, perfstats)
util.bulk_write(db.user_perf, userperfs)
Expand Down Expand Up @@ -190,6 +194,34 @@ def __init__(self, u: User):
"userId": "lichessdotorg",
}

class Coach:
def __init__(self, u: User):
self._id = u._id
self.listed = True
self.available = True
self.profile = {
"headline": random.choice(env.msgs),
"hourlyRate": random.choice(env.msgs),
"description": random.choice(env.msgs),
"playingExperience": random.choice(env.msgs),
"teachingExperience": random.choice(env.msgs),
"otherExperience": random.choice(env.msgs),
"skills": random.choice(env.msgs),
"methodology": random.choice(env.msgs),
"youtubeVideos": random.choice(env.msgs),
"youtubeChannel": random.choice(env.msgs),
"publicStudies": random.choice(env.msgs),
}
self.picture = "coach.png"
self.user = {
"rating": u.profile["fideRating"],
"seenAt": u.seenAt,
}
self.nbReviews = 0
u.roles.append("ROLE_COACH")
self.languages = ["en-US"]
self.createdAt = util.time_since_days_ago(30)
self.updatedAt = util.time_since_days_ago(30)

class Patron:
def __init__(self, uid: str):
Expand Down