@@ -78,9 +78,10 @@ The contest system has been enhanced with the following features:
78
78
### Features
79
79
- Create unlimited categories per contest
80
80
- Categories can be based on age, gender, or custom criteria
81
- - Users can join multiple categories
81
+ - ** Automatic assignment** : Users can be automatically assigned to categories based on their profile data (age, gender)
82
+ - Users can manually join multiple categories (for non-auto-assign categories)
82
83
- Separate rankings for each category
83
- - Category membership is optional
84
+ - Category membership is optional for manually-joined categories
84
85
85
86
### Admin Usage
86
87
@@ -91,23 +92,43 @@ The contest system has been enhanced with the following features:
91
92
- Fill in:
92
93
- ** Name** : e.g., "Men 18-25", "Women Elite", "Youth"
93
94
- ** Type** : Age, Gender, or Custom (optional)
94
- - ** Criteria** : Additional information (optional)
95
+ - ** Criteria** : For gender type, use: 'male', 'female', or 'other'
96
+ - ** Auto-assign** : Check this to automatically assign users who match the criteria
97
+ - ** Minimum Age** : Optional age minimum for automatic assignment
98
+ - ** Maximum Age** : Optional age maximum for automatic assignment
95
99
96
100
2 . ** Manage Categories**
97
101
- View category participants
98
102
- Edit category details
99
103
- Delete categories
104
+ - See "Auto-assign" badge for categories with automatic assignment enabled
100
105
101
106
### User Experience
102
107
103
- 1 . ** Joining Categories**
108
+ 1 . ** Profile Setup** (Required for auto-assign categories)
109
+ - Users can set their birth date and gender in their profile
110
+ - Navigate to Profile > Profile Information
111
+ - Fill in:
112
+ - ** Birth Date** : Used to calculate age for category assignment
113
+ - ** Gender** : Male, Female, or Other
114
+
115
+ 2 . ** Automatic Category Assignment**
116
+ - When a user logs a route in a contest with auto-assign categories
117
+ - The system automatically adds them to matching categories based on:
118
+ - Age range (if specified)
119
+ - Gender (if specified)
120
+ - Users see "Enrolled" badge on auto-assigned categories
121
+ - Auto-assigned categories cannot be manually left
122
+
123
+ 3 . ** Manual Category Joining**
104
124
- Visit the contest public page
105
125
- Switch to "Categories" view mode
106
126
- Browse available categories
107
- - Click "Join" on categories you want to participate in
127
+ - Click "Join" on non-auto-assign categories
108
128
- You can join multiple categories
129
+ - Click "Leave" to exit manually-joined categories
109
130
110
- 2 . ** Viewing Category Rankings**
131
+ 4 . ** Viewing Category Rankings**
111
132
- Select a category from the tabs
112
133
- Rankings show only participants in that category
113
134
- Rankings are re-calculated specifically for category members
@@ -119,14 +140,21 @@ The contest system has been enhanced with the following features:
119
140
- ` contest_id ` - Foreign key to contests
120
141
- ` name ` - Category name
121
142
- ` type ` - Type: 'age', 'gender', or 'custom'
122
- - ` criteria ` - Additional criteria description
143
+ - ` criteria ` - Additional criteria description (e.g., 'male', 'female')
144
+ - ` auto_assign ` - Boolean: whether to automatically assign users
145
+ - ` min_age ` - Integer: minimum age for automatic assignment (nullable)
146
+ - ` max_age ` - Integer: maximum age for automatic assignment (nullable)
123
147
- ` timestamps `
124
148
125
149
** contest_category_user pivot table:**
126
150
- ` contest_category_id ` - Foreign key to contest_categories
127
151
- ` user_id ` - Foreign key to users
128
152
- Unique constraint on (contest_category_id, user_id)
129
153
154
+ ** users table (new fields):**
155
+ - ` birth_date ` - Date: user's birth date for age calculation (nullable)
156
+ - ` gender ` - String: 'male', 'female', or 'other' (nullable)
157
+
130
158
## 3. Route Selection per Contest Step
131
159
132
160
### Features
@@ -232,7 +260,12 @@ The contest system has been enhanced with the following features:
232
260
- Individual rankings filtered to only include category members
233
261
- Re-ranked within the category
234
262
- Same point calculation as individual rankings
235
- - Same point calculation as individual rankings
263
+
264
+ ** Live View Rankings:**
265
+ - The live ranking view automatically adapts based on contest configuration
266
+ - If team mode is enabled, displays team rankings by default
267
+ - If team mode is disabled, displays individual rankings
268
+ - Auto-refreshes every 30 seconds to show current standings
236
269
237
270
### Step-Specific Routes
238
271
The ranking logic checks if a step has routes assigned:
@@ -248,6 +281,13 @@ $routeIds = $step->routes->count() > 0
248
281
- ` getTeamRankingForStep($stepId = null) ` - Get team rankings
249
282
- ` getCategoryRankings($categoryId, $stepId = null) ` - Get category-specific rankings
250
283
- ` getRankingForStep($stepId = null) ` - Enhanced to use step-specific routes
284
+ - ` autoAssignUserToCategories($user) ` - Automatically assign user to eligible auto-assign categories
285
+
286
+ ### ContestCategory Model
287
+ - ` userMatches($user) ` - Check if a user matches category criteria for auto-assignment
288
+
289
+ ### User Model
290
+ - ` getAge() ` - Calculate user's current age from birth_date
251
291
252
292
### Team Model
253
293
- ` getTotalPoints() ` - Calculate team's total points based on contest's team_points_mode
0 commit comments