Issue #136 noted that there was a bug in the leaderboard where it incorrectly ranks Farmers when sorting by total wealth, under certain conditions.
Some F24 teams produced a solution to the issue without adding a test that exposes the bug. If so, they earned only 5 points for the fix instead of 10.
This issue is to either
(a) fix the bug and add a test for it, if it is not already fixed in the code base (i.e. if issue 136 remains unresolved) or
(b) if the bug is already fixed, but there's no test that fails when the bug is present, add a test so that we don't end up with a regression (i.e. some team introducing the bug later, and it isn't caught by a test.)
Expected Behavior
Clicking on the "Total Wealth" table column on the leaderboard should sort the Farmers from least to greatest wealth, and clicking it again should sort from greatest to least wealth.
Undoing the change that fixes this results in a test failure.
Current / Observed Behavior
When a farmer has between $0 and $1000 (non inclusive), we notice that they are inaccurately sorted on the leaderboard.
Sorting from greatest to least should have put the first 2 farmers at the very bottom of the list, instead it puts them at the top.
We see this when sorting from least to greatest:
The farmers with $100 and $199 should have been ranked at the top of the leaderboard for having the least wealth, but they do not appear until the very bottom
The issue is probably one related to sorting "strings" vs. sorting "numbers", and will involve having to understand internal details of the OurTable component.
Recognize that the OurTable component is used in many places in the application, so you need a solution that doesn't involve putting specific special case code into that component.
For the test:
Set up some leaderboard fixtures with various dollar values out of order
Render them in the table
click the sort caret
assert that they are now in the correct order.
You can find some code in the tests for OurTable that do some similar things.
Summary
Issue #136 noted that there was a bug in the leaderboard where it incorrectly ranks Farmers when sorting by total wealth, under certain conditions.
Some F24 teams produced a solution to the issue without adding a test that exposes the bug. If so, they earned only 5 points for the fix instead of 10.
This issue is to either
(a) fix the bug and add a test for it, if it is not already fixed in the code base (i.e. if issue 136 remains unresolved) or
(b) if the bug is already fixed, but there's no test that fails when the bug is present, add a test so that we don't end up with a regression (i.e. some team introducing the bug later, and it isn't caught by a test.)
Expected Behavior
Current / Observed Behavior
When a farmer has between $0 and $1000 (non inclusive), we notice that they are inaccurately sorted on the leaderboard.
Sorting from greatest to least should have put the first 2 farmers at the very bottom of the list, instead it puts them at the top.
We see this when sorting from least to greatest:
The farmers with $100 and $199 should have been ranked at the top of the leaderboard for having the least wealth, but they do not appear until the very bottom
Steps to Reproduce
Discussion
The issue is probably one related to sorting "strings" vs. sorting "numbers", and will involve having to understand internal details of the OurTable component.
Recognize that the OurTable component is used in many places in the application, so you need a solution that doesn't involve putting specific special case code into that component.
For the test:
You can find some code in the tests for OurTable that do some similar things.