diff --git a/footballHelper.py b/footballHelper.py index bdbfe5a027b4fa0451ff1f82234a955f816388e3..3c88e4f6eac4e049f4f4259aa2dfac321837d57f 100644 --- a/footballHelper.py +++ b/footballHelper.py @@ -57,16 +57,18 @@ class Player: # value = current weekly salary x weeks left in the current contract x win percentage rate. # dividing by winrate so we can later multiply by the new winrate - mutableVal = moneyValue / (self.wins / (self.losses + self.wins)) + mutableVal = moneyValue / (self.wins / self.played) # adjust winrate accordingly if x == 'W': self.wins += 1 + self.played += 1 else: self.losses += 1 + self.played += 1 # recalculate value - mutableVal = mutableVal * (self.wins / (self.losses + self.wins)) + mutableVal = mutableVal * (self.wins / self.played) # add the values to the dictionary valueDict[f"{mutableVal:.2f}"] = f"{(mutableVal - moneyValue):.2f}" diff --git a/templates/playerSearch.html b/templates/playerSearch.html index 48ae09fe3b365d90de4111c3eb719a5b5c19c3ed..aefe29bd8f57e125e3e274b429f9927ba05b7103 100644 --- a/templates/playerSearch.html +++ b/templates/playerSearch.html @@ -4,7 +4,7 @@ {% block content %} <main> - <h1>Players</h1> + <h1>{{player.name}}</h1> <div class="buttonDown"> @@ -12,7 +12,6 @@ <div class="col-md-3"> <div class="h-100 p-5 text-bg-dark border rounded-3"> - <h2>{{player.name}}</h2> <div> <img src="{{ url_for('static', filename='images/' ~ player.gender ~ '.png') }}"/> </div> @@ -31,6 +30,7 @@ <div class="h-100 p-5 bg-dark border rounded-3"> <h2>Player Stats</h2> + <br></br> <p>Date Signed: {{ player.dateSigned }}</p> <p>Current Team: {{player.club}}</p> <p>Team Location: {{player.location}}</p> @@ -38,7 +38,7 @@ <p>Salary: £{{player.salary}}k </p> <p>Games Played: {{player.played}}</p> <p>Games Won: {{player.wins}}</p> - + <br></br> <h2>Predicted Transfer Value: £{{transferValue}}</h2> <table class="table table-striped table-dark"> diff --git a/templates/players.html b/templates/players.html index 5fa65f8e62ab24d9a2ecf9f336b85f7e67e1b7c1..4b7f5ba6eff21f70ad5d9a3c334062a20a9637af 100644 --- a/templates/players.html +++ b/templates/players.html @@ -6,7 +6,7 @@ {% block content %} <main class="mainbody"> - <h1>Players</h1> + <h1>All Players</h1> <table class="table table-striped table-dark text-center"> <thead class="thead"> <tr>