Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooked up frontend to backend for OnBuy and OnSell #65

Merged
merged 4 commits into from
Mar 15, 2022

Conversation

sophiajmoore
Copy link
Contributor

@sophiajmoore sophiajmoore commented Mar 15, 2022

Overview

When you create and join a commons, clicking on the “Buy cow” and “Sell cow” makes your total wealth increase/decrease according to the cow price, and makes the number of cows increase/decrease by 1. We edited PlayPage.js to hookup the buy and sell endpoints, and edited Play Page Tests as well.

Note that you are automatically given 1 cow to start (the CommonsController.java file has been changed to implement this). We decided to include this feature so that the user has actions to do when they spawn in!

Issues Addressed

Addresses issues #14 and #15.

Details

IMG_8394.MOV

Testing Plan

  1. Create a commons with starting balance 50 and price of cow 10.
  2. Join the commons.
  3. The Number of Cows under Your Farm Stats should be 1, Market Cow price 10, and Total Wealth is 50.
  4. When "Buy Cow" is clicked under Manage Cows, Total Wealth decreases by 10, and Number of Cows increases by 1 . Clicking it past 0 does not make Total Wealth Negative.
  5. When "Sell Cow" is clicked under Manage Cows, Total Wealth increases by 10, and Number of Cows decreases by 1. Clicking it when you have 0 cows does not add to Total Wealth.

@codecov
Copy link

codecov bot commented Mar 15, 2022

Codecov Report

Merging #65 (2f96ad3) into main (bac325e) will increase coverage by 0.33%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main      #65      +/-   ##
============================================
+ Coverage     82.18%   82.52%   +0.33%     
  Complexity       82       82              
============================================
  Files            52       52              
  Lines           466      475       +9     
  Branches         14       14              
============================================
+ Hits            383      392       +9     
  Misses           83       83              
Impacted Files Coverage Δ
frontend/src/main/pages/PlayPage.js 100.00% <100.00%> (ø)
...156/happiercows/controllers/CommonsController.java 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bac325e...2f96ad3. Read the comment docs.

@sophiajmoore sophiajmoore temporarily deployed to team04-w22-6pm-3 March 15, 2022 06:35 Inactive
@sophiajmoore sophiajmoore temporarily deployed to team04-w22-6pm-3-qa March 15, 2022 06:35 Inactive
Copy link
Contributor

@johnsonlin2001 johnsonlin2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Buy and Sell functionalities working as expected.

@sophiajmoore sophiajmoore temporarily deployed to team04-w22-6pm-3-qa March 15, 2022 15:35 Inactive
@pconrad pconrad merged commit 669a442 into main Mar 15, 2022
@pconrad pconrad added the 10 label Mar 15, 2022
@andrewhlu andrewhlu deleted the rl-sm-frontendtoback-hookup branch March 15, 2022 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants