Coder Social home page Coder Social logo

psfpl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dataisfood

psfpl's Issues

You cannot captain a player and bring him into the starting XI at the same time

If you use Set-FplLineup to bring in a player you cannot captain him in the same command. This should be allowed. Error below:

PS> Set-FplLineup -PlayersIn Barnes -PlayersOut Rondon -Captain Barnes -ViceCaptain Brooks
Set-FplLineupCaptain : You cannot captain a substitute
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Public\Set-FplLineup.ps1:129 char:19
+ ...   $Lineup = Set-FplLineupCaptain -Lineup $Lineup -Captain $Players.Ca ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Set-FplLineupCaptain

"Get-FplGameweek -Current" not returning any data

Gameweek 1 cutoff hasn't happened yet, so perhaps it is expected that the "current" week returns no data, but that does mean that you can't automate a team set-up before week 1 even though the game is up and running.

image

I'm hoping to have a fully automated season using scheduled tasks but at the moment have no way for my script to know which gameweek it's in.

Set-FplLineup errors if you transfer players in different positions

Set-FplLineup errors if you transfer players in different positions, e.g. a forward for a midfielder.

This is related to the addition of the PlayerTransformAttribute.

Example command:

Set-FplLineup -PlayersIn @{Name = 'Rondon'; Position = 'Forward'} -PlayersOut @{Name = 'Brooks'; Position = 'Midfielder'}

Example error:

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026son; Club=Man City}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026ueta; Club=Chelsea}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026ld; Club=Liverpool}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026igne; Club=Everton}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026iop; Club=West Ham}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026; Club=Southampton}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026zard; Club=Chelsea}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026ing; Club=Man City}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026; Club=Bournemouth}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026ette; Club=Arsenal}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Sort-Object : Unable to cast object of type 'System.Int64' to type 'FPL.Player.Position'.
At C:\Users\jdenton\Documents\GitHub\PSFPL\PSFPL\Private\Invoke-FplLineupSwap.ps1:55 char:40
+             $NewStarters = $Starters | Sort-Object $SortOrder
+                                        ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidResult: (@{CanSub=True; HasP\u2026rnes; Club=Burnley}:PSObject) [Sort-Object], RuntimeException
+ FullyQualifiedErrorId : ExpressionEvaluation,Microsoft.PowerShell.Commands.SortObjectCommand

Get-FplLeagueTable is not user friendly

Get-FplLeagueTable needs to be a bit more user friendly in the sense I want to make ia filter to be able to filter the user's Leagues by name or something

Commands throw when TLS1.2 isn't enabled

In Windows PowerShell only SSL3.0 and TLS1.0 are enabled by default.

On machines which haven't had newer security protocols enabled all of the commands will fail as the FPL API only supports TLS1.2.

Test code coverage not 100%

Not covering the following lines in the tests:

Code coverage report:
Covered 97.59 % of 374 analyzed Commands in 19 Files.
Missed commands:

File                     Function      Line Command                                                                    
----                     --------      ---- -------                                                                    
Public\Get-FplLineup.ps1 Get-FplLineup   18 if ((-not $Script:FplSessionData) -or (-not $Script:FplSessionData['FplS...
Public\Get-FplLineup.ps1 Get-FplLineup   18 -not $Script:FplSessionData                                                
Public\Get-FplLineup.ps1 Get-FplLineup   18 -not $Script:FplSessionData['FplSession']                                  
Public\Get-FplLineup.ps1 Get-FplLineup   19 Write-Warning 'No existing connection found'                               
Public\Get-FplLineup.ps1 Get-FplLineup   20 $Credential = Get-Credential -Message 'Please enter your FPL login details'
Public\Get-FplLineup.ps1 Get-FplLineup   21 Connect-Fpl -Credential $Credential                                        
Public\Get-FplLineup.ps1 Get-FplLineup   24 $TeamId = $Script:FplSessionData['TeamID']                                 
Public\Get-FplLineup.ps1 Get-FplLineup   26 $Response = Invoke-RestMethod -Uri "https://fantasy.premierleague.com/dr...
Public\Get-FplLineup.ps1 Get-FplLineup   28 ConvertTo-FplObject -InputObject $Response.Picks -Type 'FplLineup'    

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.