-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathseed_achievements.py
More file actions
692 lines (674 loc) ยท 23.4 KB
/
Copy pathseed_achievements.py
File metadata and controls
692 lines (674 loc) ยท 23.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
"""
Seed 50+ Achievements for Gamification System
Run this script to populate the Achievement table with comprehensive achievements
"""
from app import create_app, db
from app.models.gamification_enhanced import Achievement
app = create_app()
# Achievement definitions
ACHIEVEMENTS = [
# ============================================================================
# ACTIVITY MILESTONES (8 achievements)
# ============================================================================
{
'achievement_key': 'first_activity',
'category': 'milestone',
'subcategory': 'activities',
'title': '๐ฏ First Steps',
'description': 'Complete your first learning activity',
'icon': '๐ฏ',
'unlock_criteria': {'type': 'activity_count', 'value': 1},
'rarity': 'common',
'points_value': 10,
'is_secret': False
},
{
'achievement_key': 'activity_10',
'category': 'milestone',
'subcategory': 'activities',
'title': '๐ Getting Started',
'description': 'Complete 10 activities',
'icon': '๐',
'unlock_criteria': {'type': 'activity_count', 'value': 10},
'rarity': 'common',
'points_value': 25,
'is_secret': False
},
{
'achievement_key': 'activity_50',
'category': 'milestone',
'subcategory': 'activities',
'title': '๐ช Dedicated Learner',
'description': 'Complete 50 activities',
'icon': '๐ช',
'unlock_criteria': {'type': 'activity_count', 'value': 50},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False
},
{
'achievement_key': 'activity_100',
'category': 'milestone',
'subcategory': 'activities',
'title': '๐
Century Club',
'description': 'Complete 100 activities',
'icon': '๐
',
'unlock_criteria': {'type': 'activity_count', 'value': 100},
'rarity': 'rare',
'points_value': 100,
'is_secret': False
},
{
'achievement_key': 'activity_500',
'category': 'milestone',
'subcategory': 'activities',
'title': 'โญ Elite Achiever',
'description': 'Complete 500 activities',
'icon': 'โญ',
'unlock_criteria': {'type': 'activity_count', 'value': 500},
'rarity': 'epic',
'points_value': 250,
'is_secret': False
},
{
'achievement_key': 'activity_1000',
'category': 'milestone',
'subcategory': 'activities',
'title': '๐ Grand Master',
'description': 'Complete 1000 activities',
'icon': '๐',
'unlock_criteria': {'type': 'activity_count', 'value': 1000},
'rarity': 'legendary',
'points_value': 500,
'is_secret': False
},
{
'achievement_key': 'perfect_score',
'category': 'skill',
'subcategory': 'accuracy',
'title': '๐ฏ Perfect Score',
'description': 'Achieve 100% accuracy on any activity',
'icon': '๐ฏ',
'unlock_criteria': {'type': 'perfect_score'},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False,
'is_repeatable': True
},
{
'achievement_key': 'perfect_streak_5',
'category': 'skill',
'subcategory': 'accuracy',
'title': '๐๏ธ Perfectionist',
'description': 'Achieve 5 perfect scores in a row',
'icon': '๐๏ธ',
'unlock_criteria': {'type': 'perfect_streak', 'value': 5},
'rarity': 'rare',
'points_value': 150,
'is_secret': False
},
# ============================================================================
# STREAK ACHIEVEMENTS (7 achievements)
# ============================================================================
{
'achievement_key': 'streak_3',
'category': 'streak',
'subcategory': None,
'title': '๐ฅ On Fire!',
'description': 'Maintain a 3-day learning streak',
'icon': '๐ฅ',
'unlock_criteria': {'type': 'streak_days', 'value': 3},
'rarity': 'common',
'points_value': 30,
'is_secret': False
},
{
'achievement_key': 'streak_7',
'category': 'streak',
'subcategory': None,
'title': '๐ Week Warrior',
'description': 'Maintain a 7-day learning streak',
'icon': '๐',
'unlock_criteria': {'type': 'streak_days', 'value': 7},
'rarity': 'uncommon',
'points_value': 70,
'is_secret': False
},
{
'achievement_key': 'streak_30',
'category': 'streak',
'subcategory': None,
'title': '๐ Month Master',
'description': 'Maintain a 30-day learning streak',
'icon': '๐',
'unlock_criteria': {'type': 'streak_days', 'value': 30},
'rarity': 'rare',
'points_value': 300,
'is_secret': False
},
{
'achievement_key': 'streak_100',
'category': 'streak',
'subcategory': None,
'title': '๐ Century Streaker',
'description': 'Maintain a 100-day learning streak',
'icon': '๐',
'unlock_criteria': {'type': 'streak_days', 'value': 100},
'rarity': 'epic',
'points_value': 1000,
'is_secret': False
},
{
'achievement_key': 'streak_365',
'category': 'streak',
'subcategory': None,
'title': '๐ Year Champion',
'description': 'Maintain a 365-day learning streak',
'icon': '๐',
'unlock_criteria': {'type': 'streak_days', 'value': 365},
'rarity': 'legendary',
'points_value': 5000,
'is_secret': False
},
{
'achievement_key': 'comeback_kid',
'category': 'streak',
'subcategory': None,
'title': '๐ช Comeback Kid',
'description': 'Successfully recover a broken streak',
'icon': '๐ช',
'unlock_criteria': {'type': 'streak_recovery'},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False,
'is_repeatable': True
},
{
'achievement_key': 'freeze_master',
'category': 'streak',
'subcategory': None,
'title': 'โ๏ธ Freeze Master',
'description': 'Use 5 streak freezes',
'icon': 'โ๏ธ',
'unlock_criteria': {'type': 'freeze_count', 'value': 5},
'rarity': 'uncommon',
'points_value': 25,
'is_secret': False
},
# ============================================================================
# STUDY TIME ACHIEVEMENTS (6 achievements)
# ============================================================================
{
'achievement_key': 'study_1hour',
'category': 'milestone',
'subcategory': 'study_time',
'title': 'โฑ๏ธ Hour Power',
'description': 'Study for a total of 1 hour',
'icon': 'โฑ๏ธ',
'unlock_criteria': {'type': 'study_hours', 'value': 1},
'rarity': 'common',
'points_value': 20,
'is_secret': False
},
{
'achievement_key': 'study_10hours',
'category': 'milestone',
'subcategory': 'study_time',
'title': '๐ Study Marathon',
'description': 'Study for a total of 10 hours',
'icon': '๐',
'unlock_criteria': {'type': 'study_hours', 'value': 10},
'rarity': 'uncommon',
'points_value': 100,
'is_secret': False
},
{
'achievement_key': 'study_50hours',
'category': 'milestone',
'subcategory': 'study_time',
'title': '๐ Dedicated Student',
'description': 'Study for a total of 50 hours',
'icon': '๐',
'unlock_criteria': {'type': 'study_hours', 'value': 50},
'rarity': 'rare',
'points_value': 500,
'is_secret': False
},
{
'achievement_key': 'study_100hours',
'category': 'milestone',
'subcategory': 'study_time',
'title': '๐
Century Scholar',
'description': 'Study for a total of 100 hours',
'icon': '๐
',
'unlock_criteria': {'type': 'study_hours', 'value': 100},
'rarity': 'epic',
'points_value': 1000,
'is_secret': False
},
{
'achievement_key': 'study_500hours',
'category': 'milestone',
'subcategory': 'study_time',
'title': '๐จโ๐ Professor',
'description': 'Study for a total of 500 hours',
'icon': '๐จโ๐',
'unlock_criteria': {'type': 'study_hours', 'value': 500},
'rarity': 'legendary',
'points_value': 5000,
'is_secret': False
},
{
'achievement_key': 'intense_session',
'category': 'skill',
'subcategory': 'study_time',
'title': '๐ฅ Intense Session',
'description': 'Study for 2 hours in a single session',
'icon': '๐ฅ',
'unlock_criteria': {'type': 'session_duration', 'value': 120},
'rarity': 'uncommon',
'points_value': 75,
'is_secret': False,
'is_repeatable': True
},
# ============================================================================
# SKILL MASTERY ACHIEVEMENTS (12 achievements - 2 per skill)
# ============================================================================
{
'achievement_key': 'vocab_novice',
'category': 'skill',
'subcategory': 'vocabulary',
'title': '๐ Vocabulary Novice',
'description': 'Reach 50% vocabulary proficiency',
'icon': '๐',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'vocabulary', 'threshold': 0.5},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False
},
{
'achievement_key': 'vocab_master',
'category': 'skill',
'subcategory': 'vocabulary',
'title': '๐ Vocabulary Master',
'description': 'Reach 80% vocabulary proficiency',
'icon': '๐',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'vocabulary', 'threshold': 0.8},
'rarity': 'rare',
'points_value': 150,
'is_secret': False,
'prerequisite_achievement': 'vocab_novice'
},
{
'achievement_key': 'grammar_novice',
'category': 'skill',
'subcategory': 'grammar',
'title': 'โ๏ธ Grammar Novice',
'description': 'Reach 50% grammar proficiency',
'icon': 'โ๏ธ',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'grammar', 'threshold': 0.5},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False
},
{
'achievement_key': 'grammar_master',
'category': 'skill',
'subcategory': 'grammar',
'title': 'โ
Grammar Master',
'description': 'Reach 80% grammar proficiency',
'icon': 'โ
',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'grammar', 'threshold': 0.8},
'rarity': 'rare',
'points_value': 150,
'is_secret': False,
'prerequisite_achievement': 'grammar_novice'
},
{
'achievement_key': 'reading_novice',
'category': 'skill',
'subcategory': 'reading',
'title': '๐ Reading Novice',
'description': 'Reach 50% reading proficiency',
'icon': '๐',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'reading', 'threshold': 0.5},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False
},
{
'achievement_key': 'reading_master',
'category': 'skill',
'subcategory': 'reading',
'title': '๐ Reading Master',
'description': 'Reach 80% reading proficiency',
'icon': '๐',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'reading', 'threshold': 0.8},
'rarity': 'rare',
'points_value': 150,
'is_secret': False,
'prerequisite_achievement': 'reading_novice'
},
{
'achievement_key': 'writing_novice',
'category': 'skill',
'subcategory': 'writing',
'title': 'โ๏ธ Writing Novice',
'description': 'Reach 50% writing proficiency',
'icon': 'โ๏ธ',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'writing', 'threshold': 0.5},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False
},
{
'achievement_key': 'writing_master',
'category': 'skill',
'subcategory': 'writing',
'title': 'โ๏ธ Writing Master',
'description': 'Reach 80% writing proficiency',
'icon': 'โ๏ธ',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'writing', 'threshold': 0.8},
'rarity': 'rare',
'points_value': 150,
'is_secret': False,
'prerequisite_achievement': 'writing_novice'
},
{
'achievement_key': 'listening_novice',
'category': 'skill',
'subcategory': 'listening',
'title': '๐ Listening Novice',
'description': 'Reach 50% listening proficiency',
'icon': '๐',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'listening', 'threshold': 0.5},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False
},
{
'achievement_key': 'listening_master',
'category': 'skill',
'subcategory': 'listening',
'title': '๐ง Listening Master',
'description': 'Reach 80% listening proficiency',
'icon': '๐ง',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'listening', 'threshold': 0.8},
'rarity': 'rare',
'points_value': 150,
'is_secret': False,
'prerequisite_achievement': 'listening_novice'
},
{
'achievement_key': 'speaking_novice',
'category': 'skill',
'subcategory': 'speaking',
'title': '๐ฃ๏ธ Speaking Novice',
'description': 'Reach 50% speaking proficiency',
'icon': '๐ฃ๏ธ',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'speaking', 'threshold': 0.5},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False
},
{
'achievement_key': 'speaking_master',
'category': 'skill',
'subcategory': 'speaking',
'title': '๐ค Speaking Master',
'description': 'Reach 80% speaking proficiency',
'icon': '๐ค',
'unlock_criteria': {'type': 'skill_mastery', 'skill': 'speaking', 'threshold': 0.8},
'rarity': 'rare',
'points_value': 150,
'is_secret': False,
'prerequisite_achievement': 'speaking_novice'
},
# ============================================================================
# LEVEL ACHIEVEMENTS (6 achievements)
# ============================================================================
{
'achievement_key': 'level_a1',
'category': 'milestone',
'subcategory': 'level',
'title': '๐ฏ A1 Complete',
'description': 'Complete A1 (Beginner) level',
'icon': '๐ฏ',
'unlock_criteria': {'type': 'level_reached', 'level': 'A1'},
'rarity': 'common',
'points_value': 100,
'is_secret': False
},
{
'achievement_key': 'level_a2',
'category': 'milestone',
'subcategory': 'level',
'title': '๐ A2 Complete',
'description': 'Complete A2 (Elementary) level',
'icon': '๐',
'unlock_criteria': {'type': 'level_reached', 'level': 'A2'},
'rarity': 'uncommon',
'points_value': 200,
'is_secret': False
},
{
'achievement_key': 'level_b1',
'category': 'milestone',
'subcategory': 'level',
'title': '๐
B1 Complete',
'description': 'Complete B1 (Intermediate) level',
'icon': '๐
',
'unlock_criteria': {'type': 'level_reached', 'level': 'B1'},
'rarity': 'rare',
'points_value': 300,
'is_secret': False
},
{
'achievement_key': 'level_b2',
'category': 'milestone',
'subcategory': 'level',
'title': 'โญ B2 Complete',
'description': 'Complete B2 (Upper Intermediate) level',
'icon': 'โญ',
'unlock_criteria': {'type': 'level_reached', 'level': 'B2'},
'rarity': 'epic',
'points_value': 500,
'is_secret': False
},
{
'achievement_key': 'level_c1',
'category': 'milestone',
'subcategory': 'level',
'title': '๐ C1 Complete',
'description': 'Complete C1 (Advanced) level',
'icon': '๐',
'unlock_criteria': {'type': 'level_reached', 'level': 'C1'},
'rarity': 'legendary',
'points_value': 1000,
'is_secret': False
},
{
'achievement_key': 'level_c2',
'category': 'milestone',
'subcategory': 'level',
'title': '๐ C2 Complete',
'description': 'Complete C2 (Mastery) level - Native-like proficiency!',
'icon': '๐',
'unlock_criteria': {'type': 'level_reached', 'level': 'C2'},
'rarity': 'legendary',
'points_value': 5000,
'is_secret': False
},
# ============================================================================
# SOCIAL ACHIEVEMENTS (5 achievements)
# ============================================================================
{
'achievement_key': 'first_friend',
'category': 'social',
'subcategory': None,
'title': '๐ First Friend',
'description': 'Connect with your first friend',
'icon': '๐',
'unlock_criteria': {'type': 'friend_count', 'value': 1},
'rarity': 'common',
'points_value': 25,
'is_secret': False
},
{
'achievement_key': 'social_butterfly',
'category': 'social',
'subcategory': None,
'title': '๐ฆ Social Butterfly',
'description': 'Connect with 10 friends',
'icon': '๐ฆ',
'unlock_criteria': {'type': 'friend_count', 'value': 10},
'rarity': 'uncommon',
'points_value': 100,
'is_secret': False
},
{
'achievement_key': 'study_partner',
'category': 'social',
'subcategory': None,
'title': '๐ค Study Partner',
'description': 'Find a study partner',
'icon': '๐ค',
'unlock_criteria': {'type': 'study_partner_matched'},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False
},
{
'achievement_key': 'achievement_sharer',
'category': 'social',
'subcategory': None,
'title': '๐ข Achievement Sharer',
'description': 'Share 5 achievements',
'icon': '๐ข',
'unlock_criteria': {'type': 'achievements_shared', 'value': 5},
'rarity': 'uncommon',
'points_value': 50,
'is_secret': False
},
{
'achievement_key': 'popular',
'category': 'social',
'subcategory': None,
'title': '๐ Popular',
'description': 'Get 100 likes on shared achievements',
'icon': '๐',
'unlock_criteria': {'type': 'total_likes', 'value': 100},
'rarity': 'rare',
'points_value': 200,
'is_secret': False
},
# ============================================================================
# SECRET/SPECIAL ACHIEVEMENTS (6 achievements)
# ============================================================================
{
'achievement_key': 'night_owl',
'category': 'special',
'subcategory': None,
'title': '๐ฆ Night Owl',
'description': 'Complete 10 activities between midnight and 5 AM',
'icon': '๐ฆ',
'unlock_criteria': {'type': 'night_activities', 'value': 10},
'rarity': 'rare',
'points_value': 100,
'is_secret': True
},
{
'achievement_key': 'early_bird',
'category': 'special',
'subcategory': None,
'title': '๐
Early Bird',
'description': 'Complete 10 activities before 7 AM',
'icon': '๐
',
'unlock_criteria': {'type': 'early_activities', 'value': 10},
'rarity': 'rare',
'points_value': 100,
'is_secret': True
},
{
'achievement_key': 'speed_demon',
'category': 'special',
'subcategory': None,
'title': 'โก Speed Demon',
'description': 'Complete 10 activities in under 2 minutes each',
'icon': 'โก',
'unlock_criteria': {'type': 'fast_completions', 'value': 10},
'rarity': 'rare',
'points_value': 150,
'is_secret': True
},
{
'achievement_key': 'comeback_champion',
'category': 'special',
'subcategory': None,
'title': '๐ช Comeback Champion',
'description': 'Return after 30+ days absence and complete 10 activities',
'icon': '๐ช',
'unlock_criteria': {'type': 'comeback_after_absence', 'days': 30, 'activities': 10},
'rarity': 'epic',
'points_value': 300,
'is_secret': True
},
{
'achievement_key': 'challenge_crusher',
'category': 'special',
'subcategory': None,
'title': '๐๏ธ Challenge Crusher',
'description': 'Complete 30 daily challenges in a row',
'icon': '๐๏ธ',
'unlock_criteria': {'type': 'challenge_streak', 'value': 30},
'rarity': 'epic',
'points_value': 500,
'is_secret': True
},
{
'achievement_key': 'legend',
'category': 'special',
'subcategory': None,
'title': '๐ Legend',
'description': 'Unlock all non-secret achievements',
'icon': '๐',
'unlock_criteria': {'type': 'all_achievements_unlocked'},
'rarity': 'legendary',
'points_value': 10000,
'is_secret': True
},
]
def seed_achievements():
"""Seed achievements into database"""
with app.app_context():
print("๐ฎ Starting achievement seeding...")
# Check if achievements already exist
existing_count = Achievement.query.count()
if existing_count > 0:
print(f"โ ๏ธ Found {existing_count} existing achievements. Skipping seeding.")
print(" Delete existing achievements first if you want to re-seed.")
return
# Create achievements
created_count = 0
for achievement_data in ACHIEVEMENTS:
achievement = Achievement(**achievement_data)
db.session.add(achievement)
created_count += 1
db.session.commit()
print(f"โ
Successfully created {created_count} achievements!")
print("\n๐ Achievement Breakdown:")
print(f" - Common: {sum(1 for a in ACHIEVEMENTS if a['rarity'] == 'common')}")
print(f" - Uncommon: {sum(1 for a in ACHIEVEMENTS if a['rarity'] == 'uncommon')}")
print(f" - Rare: {sum(1 for a in ACHIEVEMENTS if a['rarity'] == 'rare')}")
print(f" - Epic: {sum(1 for a in ACHIEVEMENTS if a['rarity'] == 'epic')}")
print(f" - Legendary: {sum(1 for a in ACHIEVEMENTS if a['rarity'] == 'legendary')}")
print(f" - Secret: {sum(1 for a in ACHIEVEMENTS if a['is_secret'])}")
print("\n๐ Categories:")
categories = {}
for a in ACHIEVEMENTS:
cat = a['category']
categories[cat] = categories.get(cat, 0) + 1
for cat, count in categories.items():
print(f" - {cat.title()}: {count}")
if __name__ == '__main__':
seed_achievements()