Open mwin1201 opened 11 months ago
Adding Game week stats into the database might reduce the risk of different users seeing different stats based on their frequency of loading data.
How would this work: 1) New Database table with columns matching current objects 2) Would need to add logic to determine when to trigger the data to write to the database and if/when we need to edit the data. -- would be really nice if we could run a trigger off the event of the gameweek being complete. some sort of constantly running check such that once it turns complete we could calculate the data and save it to the database, ideally we do not want this to depend on a user load
Example GW stat object: [ { "minutes": 934, "goals_scored": 1, "assists": 3, "clean_sheets": 2, "goals_conceded": 16, "yellow_cards": 4, "red_cards": 0, "bonus": 2, "total_points": 34, "teamId": 82391, "person": "Mo Money Mo Problems", "league_entry": 82627 }, { "minutes": 910, "goals_scored": 5, "assists": 4, "clean_sheets": 2, "goals_conceded": 13, "yellow_cards": 0, "red_cards": 0, "bonus": 7, "total_points": 68, "teamId": 82971, "person": "CT Boy", "league_entry": 83210 }, { "minutes": 873, "goals_scored": 0, "assists": 2, "clean_sheets": 4, "goals_conceded": 11, "yellow_cards": 0, "red_cards": 0, "bonus": 0, "total_points": 35, "teamId": 86842, "person": "Bangers and Rash", "league_entry": 87087 }, { "minutes": 728, "goals_scored": 5, "assists": 4, "clean_sheets": 0, "goals_conceded": 14, "yellow_cards": 1, "red_cards": 0, "bonus": 10, "total_points": 61, "teamId": 86849, "person": "Dierbetes", "league_entry": 87094 }, { "minutes": 963, "goals_scored": 3, "assists": 3, "clean_sheets": 2, "goals_conceded": 17, "yellow_cards": 0, "red_cards": 0, "bonus": 3, "total_points": 48, "teamId": 86873, "person": "Gottleib City", "league_entry": 87118 }, { "minutes": 855, "goals_scored": 2, "assists": 1, "clean_sheets": 2, "goals_conceded": 16, "yellow_cards": 2, "red_cards": 0, "bonus": 3, "total_points": 40, "teamId": 87462, "person": "You never w@nk alone", "league_entry": 87711 }, { "minutes": 941, "goals_scored": 2, "assists": 3, "clean_sheets": 0, "goals_conceded": 18, "yellow_cards": 0, "red_cards": 0, "bonus": 1, "total_points": 40, "teamId": 118946, "person": "Stoke City Fan", "league_entry": 119323 }, { "minutes": 872, "goals_scored": 3, "assists": 0, "clean_sheets": 0, "goals_conceded": 16, "yellow_cards": 3, "red_cards": 0, "bonus": 3, "total_points": 32, "teamId": 126657, "person": "Real CT boy stand UP", "league_entry": 127064 }, { "minutes": 844, "goals_scored": 4, "assists": 0, "clean_sheets": 1, "goals_conceded": 19, "yellow_cards": 4, "red_cards": 0, "bonus": 4, "total_points": 33, "teamId": 131202, "person": "Earth Wind & Maguire", "league_entry": 131621 }, { "minutes": 799, "goals_scored": 4, "assists": 1, "clean_sheets": 2, "goals_conceded": 11, "yellow_cards": 0, "red_cards": 0, "bonus": 6, "total_points": 44, "teamId": 210933, "person": "SUPER SAKA 777", "league_entry": 211849 } ]