MrPig91 / PSSplinterlands

This is a powershell module used to interact with the Splinterlands API.
MIT License
2 stars 1 forks source link

sorting errors with Get-slDECRewardsSummary #1

Open dondzes opened 2 years ago

dondzes commented 2 years ago

Hello.

Trying out your tool and notice some sorting errors and missing column data.

PS /home/ubuntu> Get-slDECRewardsSummary -UserName doombledore /usr/bin/sort: cannot read: created_date: No such file or directory

/usr/bin/sort: cannot read: created_date: No such file or directory /usr/bin/sort: cannot read: created_date: No such file or directory /usr/bin/sort: cannot read: created_date: No such file or directory RewardType RewardCount AvgReward AvgDailyDEC AvgRewardsPerDay Total TotalDays


Battle 355 17.23 6117.521 Quest 19 51.84 985
Season 2 83 166
All 376 19.33 7268.521

$ pwsh PowerShell 7.2.0 Copyright (c) Microsoft Corporation.

https://aka.ms/powershell

$lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 21.04 Release: 21.04 Codename: hirsute

MrPig91 commented 2 years ago

Hey @dondzes , Thank you for reporting this error. It appears you are using a linux OS. I lazily used some common alias for command such as select and sort for select-object and sort-object. I think these will mess up on Linux. I have updated the modules to use the full command names instead of aliases. Let me know if this resolves the issue, if not I might have to dig deeper, but this was the first thing that came to mind. You will have to update to the newest version, by running Update-Module PSSplinterlands. Thank you for test out my tools :)

dondzes commented 2 years ago

I did an update and the issue still exists. Perhaps you need a posix sort.

PS /home/ubuntu> Update-Module PSSplinterlands

Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A PS /home/ubuntu> Get-slDECRewardsSummary -UserName doombledore
/usr/bin/sort: cannot read: created_date: No such file or directory

/usr/bin/sort: cannot read: created_date: No such file or directory /usr/bin/sort: cannot read: created_date: No such file or directory /usr/bin/sort: cannot read: created_date: No such file or directory RewardType RewardCount AvgReward AvgDailyDEC AvgRewardsPerDay Total TotalDays


Battle 354 17.24 6102.305 Quest 19 51.84 985
Season 2 83 166
All 375 19.34 7253.305

dondzes commented 2 years ago

I did some googling and this appears to be an issue with linux port of powershell. I also found a work-around :)

PS /home/ubuntu> Set-Alias sort Sort-Object PS /home/ubuntu> Get-slDECRewardsSummary -UserName doombledore

RewardType RewardCount AvgReward AvgDailyDEC AvgRewardsPerDay Total TotalDays


Battle 360 17.14 213 12 6171.735 29 Quest 18 53.11 37 1 956 26 Season 2 83 11 0 166 15 All 380 19.19 252 13 7293.735 29