File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -158,23 +158,27 @@ def _get_chart_json(request, finance_method):
158
158
current_season_number = Matchday .objects .all ()[0 ].season .number
159
159
season_number = request .GET .get ('season_number' , default = current_season_number )
160
160
finances_this_season = Finance .objects .filter (user = request .user , matchday__season__number = season_number )
161
+
162
+ chart_json = {
163
+ "series" : finance_method (_get_finance_diffs (finances_this_season )),
164
+ "categories" : _get_matchdays_from_existing_finances (finances_this_season )
165
+ }
166
+ return chart_json
167
+
168
+
169
+ def _get_finance_diffs (finances_this_season ):
161
170
diffs = []
162
- matchdays = []
163
171
if len (finances_this_season ) >= 1 :
164
172
first_finance_diff = finances_this_season [0 ].diff (Finance ())
165
-
166
173
diffs .append (first_finance_diff )
167
- matchdays .append (finances_this_season [0 ].matchday .number )
168
174
for idx , _ in enumerate (finances_this_season ):
169
175
if idx + 1 < finances_this_season .count ():
170
176
diffs .append (finances_this_season [idx ].diff (finances_this_season [idx + 1 ]))
171
- matchdays .append (finances_this_season [idx + 1 ].matchday .number )
172
- series = finance_method (diffs )
173
- chart_json = {
174
- "series" : series ,
175
- "categories" : matchdays
176
- }
177
- return chart_json
177
+ return diffs
178
+
179
+
180
+ def _get_matchdays_from_existing_finances (finances_this_season ):
181
+ return [finance .matchday .number for finance in finances_this_season ]
178
182
179
183
180
184
def _get_finance_attribute_json (name , finance_data ):
You can’t perform that action at this time.
0 commit comments