Commit c02c9f2
Add Total XP Calculation (#859)
* Add TestApi
* Update totalXp GetRequest
* Add total xp logic
* move totalxp logic into achievements.ex
* Update achievements.ex
* Change Function Name
* Add assessment xp calculation
* Remove redundant code
* Update incentives view
* Fix Bugs
- xp calc based on user_id
- xp calc based on goal count
* Refactor Code
- run mix format
* Code cleanup
- Inlined small functions
- Changed function naming related to calculating total xp
- Moved total_xp endpoint to user route
* Update mix.lock
* Fix total_xp query
- Calculate total xp through a single query.
- Fix variable issues in user_controller
* Fix credo formatting errors
* Add swagger path for combined_total_xp
Fixes some other user route issues
* Add normal test for total_xp route
Add test
* Update user_controller_test.exs
* Fix imports
* Add more tests for total_xp route
* Update test names
* Add is_variable_xp: true tests
* Remove added @SPEC lines
* Tweak documentation
* Call swagger_path combined_total_xp in tests
Co-authored-by: Richard Qi <55354921+riccqi@users.noreply.github.com>
Co-authored-by: angelsl <angelsl@in04.sg>1 parent d4f733f commit c02c9f2
File tree
4 files changed
+836
-17
lines changed- lib
- cadet_web
- controllers
- cadet/incentives
- test/cadet_web/controllers
4 files changed
+836
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 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 | + | |
24 | 66 | | |
25 | 67 | | |
26 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
10 | 9 | | |
11 | 10 | | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
115 | 128 | | |
116 | | - | |
| 129 | + | |
117 | 130 | | |
118 | 131 | | |
119 | 132 | | |
| |||
124 | 137 | | |
125 | 138 | | |
126 | 139 | | |
127 | | - | |
| 140 | + | |
128 | 141 | | |
129 | 142 | | |
130 | 143 | | |
| |||
135 | 148 | | |
136 | 149 | | |
137 | 150 | | |
138 | | - | |
| 151 | + | |
139 | 152 | | |
140 | 153 | | |
141 | 154 | | |
| |||
148 | 161 | | |
149 | 162 | | |
150 | 163 | | |
151 | | - | |
| 164 | + | |
152 | 165 | | |
153 | 166 | | |
154 | 167 | | |
| |||
161 | 174 | | |
162 | 175 | | |
163 | 176 | | |
164 | | - | |
| 177 | + | |
165 | 178 | | |
166 | 179 | | |
167 | 180 | | |
168 | 181 | | |
169 | 182 | | |
170 | | - | |
| 183 | + | |
171 | 184 | | |
172 | 185 | | |
173 | 186 | | |
| |||
181 | 194 | | |
182 | 195 | | |
183 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
184 | 213 | | |
185 | 214 | | |
186 | 215 | | |
| |||
202 | 231 | | |
203 | 232 | | |
204 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
205 | 243 | | |
206 | 244 | | |
207 | 245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
0 commit comments