@@ -39,9 +39,8 @@ def get(self, request, *args, **kwargs):
3939 contracts = Contract .objects .filter (user = self .request .user , sold_on_matchday = None )
4040 players = [contract .player for contract in contracts ]
4141 current_matchday = Matchday .objects .all ()[0 ]
42- current_season = current_matchday .season
4342
44- newer_matchday_season = self .request .GET .get ('newer_matchday_season' , default = current_season .number )
43+ newer_matchday_season = self .request .GET .get ('newer_matchday_season' , default = current_matchday . season .number )
4544 newer_matchday = self .request .GET .get ('newer_matchday' , default = current_matchday .number )
4645 older_matchday_season = self .request .GET .get ('older_matchday_season' )
4746 older_matchday = self .request .GET .get ('older_matchday' )
@@ -60,11 +59,12 @@ def get(self, request, *args, **kwargs):
6059 player_statistics_json = [
6160 self ._get_player_statistics_diff_in_json (newer_player_statistics , older_player_statistics )
6261 for (newer_player_statistics , older_player_statistics ) in player_statistics_tuples
63- ]
62+ ]
6463
6564 return self .render_json_response (player_statistics_json )
6665
67- def _get_statistics_from_player_and_matchday (self , player ,
66+ @staticmethod
67+ def _get_statistics_from_player_and_matchday (player ,
6868 newer_matchday_season , newer_matchday ,
6969 older_matchday_season , older_matchday ):
7070
@@ -90,7 +90,8 @@ def _get_statistics_from_player_and_matchday(self, player,
9090
9191 return newer_player_statistics , older_player_statistics
9292
93- def _get_player_statistics_diff_in_json (self , newer_player_statistics , older_player_statistics ):
93+ @staticmethod
94+ def _get_player_statistics_diff_in_json (newer_player_statistics , older_player_statistics ):
9495 """
9596 Args:
9697 newer_player_statistics: newer statistic
@@ -245,12 +246,9 @@ def get(self, request, *args, **kwargs):
245246
246247 return self .render_json_response (finances_json )
247248
248- def _get_finances_diff_in_json (self , newer_finances , older_finances ):
249+ @staticmethod
250+ def _get_finances_diff_in_json (newer_finances , older_finances ):
249251 """
250- Args:
251- newer_finances: newer finances
252- older_finances: older finances
253-
254252 Returns:
255253 A dictionary of finance data. If older_finances is None newer_finances is returned
256254 """
@@ -430,7 +428,7 @@ def get(self, request, *args, **kwargs):
430428 income_betting .append (data_source [0 ].income_betting )
431429 matchdays .append (data_source [0 ].matchday .number )
432430
433- for idx , entry in enumerate (data_source ):
431+ for idx , _ in enumerate (data_source ):
434432 if idx + 1 < data_source .count ():
435433 income_visitors_league .append (
436434 data_source [idx + 1 ].income_visitors_league - data_source [idx ].income_visitors_league )
@@ -508,7 +506,7 @@ def get(self, request, *args, **kwargs):
508506 expenses_betting .append (- data_source [0 ].expenses_betting )
509507 matchdays .append (data_source [0 ].matchday .number )
510508
511- for idx , entry in enumerate (data_source ):
509+ for idx , _ in enumerate (data_source ):
512510 if idx + 1 < data_source .count ():
513511 expenses_player_salaries .append (
514512 data_source [idx ].expenses_player_salaries - data_source [idx + 1 ].expenses_player_salaries )
@@ -580,11 +578,9 @@ def get(self, request, *args, **kwargs):
580578
581579 return self .render_json_response (match_json )
582580
583- def _get_match_in_json (self , match ):
581+ @staticmethod
582+ def _get_match_in_json (match ):
584583 """
585- Args:
586- match: Match
587-
588584 Returns:
589585 A dictionary of match data.
590586 """
@@ -746,11 +742,9 @@ def get(self, request, *args, **kwargs):
746742
747743 return self .render_json_response (stadium_statistics_json )
748744
749- def _get_stadium_statistics_in_json (self , stadium_stat ):
745+ @staticmethod
746+ def _get_stadium_statistics_in_json (stadium_stat ):
750747 """
751- Args:
752- stadium_stat: MatchStadiumStatistics
753-
754748 Returns:
755749 A dictionary of stadium statistics data.
756750 """
0 commit comments