diff --git a/CHANGELOG.md b/CHANGELOG.md index b515d54b4..3415f76c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. +## [1.2.11] - 2021-01-03 + +### Added + +- PPG Records [#92](https://github.com/nmelhado/league-page/issues/92) + - Big thank you to [OldNewsBlues](https://github.com/OldNewsBlues) for implementing this + ## [1.2.10] - 2022-01-03 ### Fixed diff --git a/package-lock.json b/package-lock.json index f4c3ae143..f0a819953 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "league-page", - "version": "1.2.10", + "version": "1.2.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "league-page", - "version": "1.2.10", + "version": "1.2.11", "license": "MIT", "dependencies": { "@smui/button": "4.2.0", diff --git a/package.json b/package.json index 09b3e1ba8..84719615a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "league-page", - "version": "1.2.10", + "version": "1.2.11", "homepage": "https://github.com/nmelhado/league-page", "repository": { "type": "git", diff --git a/src/lib/Records/AllTimeRecords.svelte b/src/lib/Records/AllTimeRecords.svelte index 141816141..326cbb33f 100644 --- a/src/lib/Records/AllTimeRecords.svelte +++ b/src/lib/Records/AllTimeRecords.svelte @@ -28,10 +28,11 @@ for(const key in leagueRosterRecords) { const leagueRosterRecord = leagueRosterRecords[key]; + const denominator = (leagueRosterRecord.wins + leagueRosterRecord.ties + leagueRosterRecord.losses) > 0 ? (leagueRosterRecord.wins + leagueRosterRecord.ties + leagueRosterRecord.losses) : 1; winPercentages.push({ rosterID: key, manager: currentManagers[key], - percentage: round((leagueRosterRecord.wins + leagueRosterRecord.ties / 2) / (leagueRosterRecord.wins + leagueRosterRecord.ties + leagueRosterRecord.losses) * 100), + percentage: round((leagueRosterRecord.wins + leagueRosterRecord.ties / 2) / denominator * 100), wins: leagueRosterRecord.wins, ties: leagueRosterRecord.ties, losses: leagueRosterRecord.losses, @@ -55,6 +56,7 @@ manager: currentManagers[key], fptsFor: round(leagueRosterRecord.fptsFor), fptsAgainst: round(leagueRosterRecord.fptsAgainst), + fptsPerGame: round(leagueRosterRecord.fptsFor / denominator), }) if(leagueRosterRecord.ties > 0) showTies = true; diff --git a/src/lib/Records/PerSeasonRecords.svelte b/src/lib/Records/PerSeasonRecords.svelte index 04b6dee7a..f87fe2c0c 100644 --- a/src/lib/Records/PerSeasonRecords.svelte +++ b/src/lib/Records/PerSeasonRecords.svelte @@ -55,12 +55,14 @@ } const fpts = round(season.fpts); + const fptsPerGame = round(season.fptsPerGame); // add season-long scoring record yearsObj[season.year].seasonLongRecords.push({ manager: season.manager, rosterID, fpts, + fptsPerGame, year: null, }) @@ -93,6 +95,7 @@ manager: season.manager, fptsFor: round(season.fpts), fptsAgainst: round(season.fptsAgainst), + fptsPerGame: round(season.fptsPerGame), }) } } diff --git a/src/lib/Records/RecordsAndRankings.svelte b/src/lib/Records/RecordsAndRankings.svelte index c6df73b4c..248d3fc8d 100644 --- a/src/lib/Records/RecordsAndRankings.svelte +++ b/src/lib/Records/RecordsAndRankings.svelte @@ -432,7 +432,7 @@ - {prefix} Season-long Scoring Records + {prefix} Season-long Scoring Records @@ -441,6 +441,7 @@ Year {/if} Total Points + PPG @@ -457,6 +458,7 @@ {mostSeasonLongPoint.year} {/if} {mostSeasonLongPoint.fpts} + {mostSeasonLongPoint.fptsPerGame} {/each} @@ -632,7 +634,7 @@ - + {prefix} Fantasy Points Rankings @@ -641,6 +643,7 @@ Manager Points For Points Against + Points Per Game @@ -655,6 +658,7 @@ {fptsHistory.fptsFor} {fptsHistory.fptsAgainst} + {fptsHistory.fptsPerGame} {/each} diff --git a/src/lib/utils/helperFunctions/leagueRecords.js b/src/lib/utils/helperFunctions/leagueRecords.js index 959d13cba..d467f50da 100644 --- a/src/lib/utils/helperFunctions/leagueRecords.js +++ b/src/lib/utils/helperFunctions/leagueRecords.js @@ -6,6 +6,7 @@ import { getLeagueUsers } from "./leagueUsers" import { waitForAll } from './multiPromise'; import { get } from 'svelte/store'; import {records} from '$lib/stores'; +import { round } from './universalFunctions'; export const getLeagueRecords = async (refresh = false) => { if(get(records).seasonWeekRecords) { @@ -99,6 +100,7 @@ export const getLeagueRecords = async (refresh = false) => { const fpts = roster.settings.fpts + (roster.settings.fpts_decimal / 100); const fptsAgainst = roster.settings.fpts_against + (roster.settings.fpts_against_decimal / 100); + const fptsPerGame = fpts / (roster.settings.wins + roster.settings.losses + roster.settings.ties); const potentialPoints = roster.settings.ppts + (roster.settings.ppts_decimal / 100); // add records to league roster record record @@ -116,6 +118,7 @@ export const getLeagueRecords = async (refresh = false) => { ties: roster.settings.ties, fpts, fptsAgainst, + fptsPerGame, potentialPoints, manager: originalManagers[rosterID], year @@ -126,6 +129,7 @@ export const getLeagueRecords = async (refresh = false) => { mostSeasonLongPoints.push({ rosterID, fpts, + fptsPerGame: round(fptsPerGame), year, manager: originalManagers[rosterID] }) diff --git a/src/lib/version.js b/src/lib/version.js index 702e05e9e..2bc104d15 100644 --- a/src/lib/version.js +++ b/src/lib/version.js @@ -5,4 +5,4 @@ available for your copy of League Page */ // Keep in sync with package.json -export const version = "1.2.10"; +export const version = "1.2.11";