ucsb-cs156-f24 / proj-happycows-f24-11

1 stars 0 forks source link

Fix sorting by wealth bug on Leaderboard table AND add test that fails if the bug is reintroduced. #39

Open github-actions[bot] opened 4 days ago

github-actions[bot] commented 4 days ago

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.

Screenshot 2024-11-14 at 5 23 57 PM

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:

Screenshot 2024-11-14 at 5 24 17 PM

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

  1. https://happycows.dokku-00.cs.ucsb.edu/
  2. Navigate to the Testing Commons
  3. Navigate to the leaderboard
  4. Sort by Total Wealth

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.

github-actions[bot] commented 4 days ago

Copied from https://github.com/ucsb-cs156/proj-happycows/issues/140