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

Added Population Check to Education Module #4281

Merged
merged 10 commits into from
Jun 27, 2024

Conversation

IllianiCBT
Copy link
Collaborator

This PR adds a check to ensure a system is populated before allowing personnel to attend academies there.

Additionally, I added a check for total system population depletion after enrolling (as part of the new week checks). This ensures more accurate dates for the destruction of prestigious academies when that destruction results from system depopulation (assuming we have accurate data). If accurate data isn't available, mhq will default to the academy's static destruction year (defined in the academy XML) as a fallback.

This also allows extending academy destruction events to local academies, which wasn't possible previously.

Marking this as a bug, as personnel being able to attend academies with 0 system population is unintended behavior.

…on EducationController

- Included a check for system depopulation, implying academy destruction in EducationController
- Modified checkForAcademyDestruction to take into account system's population depletion
@IllianiCBT IllianiCBT added Bug Personnel Personnel-related Issues GUI labels Jun 23, 2024
@IllianiCBT IllianiCBT self-assigned this Jun 23, 2024
@IllianiCBT IllianiCBT changed the title Add Population Check to Education Module Added Population Check to Education Module Jun 23, 2024
Copy link
Member

@NickAragua NickAragua left a comment

Choose a reason for hiding this comment

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

Why are we bothering making this an option? I guess it's fine, but I just don't see a situation where we'd want to have academies in uninhabited systems.

@IllianiCBT
Copy link
Collaborator Author

Why are we bothering making this an option? I guess it's fine, but I just don't see a situation where we'd want to have academies in uninhabited systems.

The option is to enable the message that tells users why there is no academy in the relevant system. Otherwise the academies will just be missing with no explanation as to why.

@IllianiCBT
Copy link
Collaborator Author

I just spotted the cause of confusion: enablePopulationConflict should have been enableShowPopulationConflict. Pushing a fix.

@NickAragua
Copy link
Member

NickAragua commented Jun 24, 2024

Why are we bothering making this an option? I guess it's fine, but I just don't see a situation where we'd want to have academies in uninhabited systems.

The option is to enable the message that tells users why there is no academy in the relevant system. Otherwise the academies will just be missing with no explanation as to why.

I guess in that case, I'm even more convinced that we don't really need it to be an option.

@IllianiCBT
Copy link
Collaborator Author

Would you be able to advise why you don't think the option is needed? I think it would be helpful if I better knew the direction you were coming from :)

@NickAragua
Copy link
Member

I think a screenshot of the affected area may be helpful to understand what we're talking about exactly. Right now, to me, it looks like you're adding a campaign config option to control the display of invalid locations of academies in a menu where academies are being assigned to a person? What's the scenario where you'd want to be able to say that a person is attending a blown up academy?

@IllianiCBT
Copy link
Collaborator Author

The campaign option is part of this range of choices. Each option determines which academies will still be displayed when certain ineligibility criteria are met. Instead of simply disabling the 'show ineligible academies' option, which would hide all academies the individual is ineligible for, this option allows for more nuanced control.

When in use, academies will be shown like this:

Image

These academies cannot be interacted with, but they inform the user why the academy can't be selected. However, the user may decide that they don't care, in which case the option can be disabled. But perhaps they do care, or maybe they only care if the system is depopulated. By removing the campaign option, we take away that choice from the user. Moreover, it could potentially lead to false bug reports with users claiming that academies aren't displaying. Or, worse, that academies aren't showing when they should, but the user assumes it's because their personnel are ineligible.

I introduced these options to prevent situations like this, where it's difficult for the user to easily see what academies they can send personnel to:

Image

But also to avoid situations like this, where no academies are visible, but the user has no way to tell why:

Image

I hope this clarifies things. I understand it's not always easy to envision how things will appear in-game when all you have is the GitHub changes list. :)

@codecov-commenter
Copy link

codecov-commenter commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 9.67742% with 28 lines in your changes missing coverage. Please review.

Project coverage is 10.29%. Comparing base (c7a34c3) to head (f756040).
Report is 55 commits behind head on master.

Current head f756040 differs from pull request most recent head d6dcece

Please upload reports for the commit d6dcece to get more accurate results.

Files Patch % Lines
MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java 0.00% 10 Missing ⚠️
.../mekhq/gui/adapter/PersonnelTableMouseAdapter.java 0.00% 9 Missing ⚠️
...paign/personnel/education/EducationController.java 0.00% 5 Missing ⚠️
MekHQ/src/mekhq/campaign/CampaignOptions.java 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #4281   +/-   ##
=========================================
  Coverage     10.29%   10.29%           
- Complexity     5816     5819    +3     
=========================================
  Files           925      925           
  Lines        125882   125917   +35     
  Branches      18628    18637    +9     
=========================================
+ Hits          12954    12959    +5     
- Misses       111656   111685   +29     
- Partials       1272     1273    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NickAragua
Copy link
Member

Fair enough. I'm not really a giant fan of adding an option for everything as it tends to increase code complexity; I'm also not convinced that adding an extra option buried in campaign settings somewhere will help with user complaints. But since the work is done already, we may as well leave it in.

@IllianiCBT
Copy link
Collaborator Author

IllianiCBT commented Jun 26, 2024

I see your point. I know you just approved this, but I’m going to go ahead and reduce the options down to just ‘display ineligible academies’. I think having all these campaign options solves a problem that doesn’t exist.

- Removed configuration options for different types of eligibility conflicts in the education module
- Simplified eligibility check to only rely on the "showIneligibleAcademies" setting without considering specific conflicts
- Cleaned up associated UI options and settings serialization
# Conflicts:
#	MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java
@IllianiCBT IllianiCBT merged commit f5d16cf into MegaMek:master Jun 27, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug GUI Personnel Personnel-related Issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants