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 Ability to Manually Drop Personnel out of Active Education #4366

Merged
merged 13 commits into from
Jul 12, 2024

Conversation

IllianiCBT
Copy link
Collaborator

This PR builds on changes made in #4365 and should be merged after that PR.

This PR adds the ability to manually drop personnel out of their current education. It does this via the right-click personnel menu. It also does some minor refactoring to PersonnelTableMouseAdapter.java.

With #4365, this PR closes #4359

The education checks in EducationController.java were refactored for improved readability and maintainability. The code was broken down into individual methods each handling a specific type of check: weekly, monthly, and yearly.
The text for the "barely graduated" education status in the Education.properties file was updated. The revised version provides a more specific phrase that includes the name of the institution from which the individual has barely graduated.
Refactored the EducationController class, specifically the methods which generate prefixes, suffixes, and types. Switch-case statements were refactored for quick assignment of strings. Removed code that checked for the start of a new month to allocate training XP, which is no longer required. Improvements were also made to add bonus XP. The "graduatedBarely" and "graduatedChild" conditions were streamlined, thus removing duplicated code. Finally, removed the redundant use of Collectors.toList().
The code now checks if the person's highest education level is less than the academy's education level before awarding bonus XP. This prevents a potential exploit in XP distribution.
The method 'checkForAcademyClosure' in EducationController was refactored. The return type was changed from boolean to void as the returned boolean value was not used elsewhere in the code.
The random XP option in the campaign was replaced with a more flexible bonus XP multiplier. Furthermore, all references to the old system were removed from the UI and the underlying codebase.
The calculation for xpRate in the addBonusXp method of EducationController was updated. The formula was adjusted to factor in the faculty skill level and operate over a different range by dividing the time spent in education by 600, rather than 150.
The variable "bonusXpRate" used in different places in CampaignOptions class was renamed to "facultyXpRate". Accompanying changes were made in labels, Spinner and other related methods and comments as well to maintain consistency. This refactoring was made to provide more clarity in identifying the purpose of the variable.
The method 'addBonusXp' was renamed to 'addFacultyXp' to more accurately reflect its functionality. The related variable and calculations were updated accordingly. Moreover, a base XP rate is now also awarded when the person's highest education level is equal or greater than the academy's education level.
In the EducationController class, a line of code has been added for granting faculty XP when a person drops out of education.
Added options to handle student dropouts within the educational module of the MekHQ application. This includes an added tooltip and text message within the GUI properties file, and the functionality to process student dropout scenarios within the PersonnelTableMouseAdapter.java.
A new method, processForcedDropOut, was introduced in the EducationController class. This allows users to manually drop personnel out of educations for whatever reason.
Corrected the mistaken usage of CMD_COMPLETE_STAGE with the correct CMD_DROP_OUT as action command for dropping out students.
@IllianiCBT IllianiCBT added the Personnel Personnel-related Issues label Jul 10, 2024
@IllianiCBT IllianiCBT self-assigned this Jul 10, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.26%. Comparing base (8bb8a5e) to head (ff40b24).
Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4366      +/-   ##
============================================
- Coverage     10.27%   10.26%   -0.01%     
+ Complexity     5810     5808       -2     
============================================
  Files           925      925              
  Lines        125997   125989       -8     
  Branches      18646    18639       -7     
============================================
- Hits          12941    12938       -3     
+ Misses       111781   111776       -5     
  Partials       1275     1275              

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

@IllianiCBT IllianiCBT merged commit 6015d82 into MegaMek:master Jul 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Personnel Personnel-related Issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFE: Education Module Tweaks
3 participants