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

Updates to UI to show how many units can be purchased. #11273

Closed
wants to merge 2 commits into from

Conversation

jtkenny
Copy link

@jtkenny jtkenny commented Dec 6, 2022

Change Summary & Additional Notes

Release Note

This is the pull request for the changes done by the ISU students. This contains the UI updates requested on the forum for displaying the total number of units that can be bought. The related issue is here: #11258

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link

codecov bot commented Dec 7, 2022

Codecov Report

Merging #11273 (abcd152) into master (1a1e23e) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##             master   #11273      +/-   ##
============================================
- Coverage     27.21%   27.20%   -0.01%     
+ Complexity     8251     8249       -2     
============================================
  Files          1217     1217              
  Lines         78080    78088       +8     
  Branches      10615    10616       +1     
============================================
- Hits          21250    21246       -4     
- Misses        54862    54875      +13     
+ Partials       1968     1967       -1     
Impacted Files Coverage Δ
...ava/games/strategy/triplea/ui/ProductionPanel.java 0.00% <0.00%> (ø)
...rc/main/java/games/strategy/net/nio/NioReader.java 82.50% <0.00%> (-3.75%) ⬇️
...strategy/net/nio/ServerQuarantineConversation.java 89.47% <0.00%> (-1.76%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@beelee1
Copy link
Contributor

beelee1 commented Dec 8, 2022

@jtkenny nice 👍 It's been a few days so lets go ahead and ping @DanVanAtta . He hasn't been active lately but I know he's interested in your work. Will ping @RoiEXLab too :)

@RoiEXLab
Copy link
Member

RoiEXLab commented Dec 8, 2022

@jtkenny From a coding perspective the changes seem fine. Please fix the formatting violations by running ./gradlew :game-app:game-core:spotlessApply.

@beelee1 @jtkenny Can you give me some background on this change? Screenshots of the "before" and "after" state would be super useful, because I'm not familiar with those specific parts of the code

@TheDog-GH
Copy link
Contributor

@RoiEXLab
It relates to my (& by others) request here;
https://forums.triplea-game.org/topic/3311/student-group-studying-triplea/2

@RoiEXLab
Copy link
Member

RoiEXLab commented Dec 8, 2022

@TheDog-GH Thanks for clarifying. In this case I'm just asking for the screenshots (as mentioned earlier) for future reference and to fix the formatting. 👍🏼
Thanks for your time

@jtkenny
Copy link
Author

jtkenny commented Dec 8, 2022

Before:
image

After:
after

final Action doneAction = SwingAction.of("Done", () -> dialog.setVisible(false));

ProductionPanel(final UiContext uiContext) {
this.uiContext = uiContext;
lowestCost = 100000;
Copy link
Member

Choose a reason for hiding this comment

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

One thing I forgot to ask: Where does this value of 100k come from? Is it just an arbitrarily high number or is there a deeper meaning?

Copy link
Author

Choose a reason for hiding this comment

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

Arbitrary high number. If it was zero, then if the associated if statement was never triggered it would cause divide by zero.

Copy link
Member

Choose a reason for hiding this comment

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

Ah okay, in this case is something speaking against using Integer.MAX_VALUE? Also if you want to can assign the value in the same line where you define the variable. No need to put it into the constructor

@DanVanAtta
Copy link
Member

DanVanAtta commented Dec 12, 2022

Thanks for taking a whack at this update and the work you have put in.

Few questions:

(1) Have you considered any other UI treatments?

I'm not sure we want to go with the UI treatment suggested. What bugs me is how it groups visually in my brain, it looks like "1 | 2" and "1 < 10" to me.

If you are short on ideas for alternatives, there are a few UI designer folks who hang out on the forums who likely would provide more than feedback and options than you could shake a stick at.

(2) Are there any functionality changes to limit the max from being entered? For example, does the "up" arrow toggle become disabled when at the max? If a user enters in a value over the max, is it overwritten with the max?

(3) How extensively have edge cases been considered? Notably I'm thinking of maps where there is placement that is outside of factories (one example is placing allied units on china I think in BWv3 maps). Have you checked additional maps like civil war and others that have some extra variation for unit placement?


My availability has been pretty poor lately. Apologies in advance for any delayed responses. Otherwise, generally I think we should focus on:

  • getting these updates right
  • getting the updates to look good
  • ensuring code quality/style is reasonable and consistent

@DanVanAtta
Copy link
Member

Ah, just noticed an interesting thing here is the difference between max able to purchase (due to cost) and the max that could be purchased due to placement. I think the latter is the really interesting number.
Perhaps we can prune the UI updates down to just the update in the lower left corner where it says (0/10 units purchased). That denominator value is most interesting when it is equal to the max production capacity (rather than say the max number that can be purchased before running out of money).

@DanVanAtta DanVanAtta closed this Jan 14, 2023
@DanVanAtta
Copy link
Member

Please re-open @jtkenny when you're ready & consider marking this PR as a draft as well. Given it's a been a month without any update, I'm marking this as closed to remove it from the active queue.

@TheDog-GH
Copy link
Contributor

@asvitkine
This PR by some students might be of use.
It never got actioned and is very similar to the other one with no code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants