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

Childrens filter in personnel screen #3771

Merged
merged 6 commits into from
Oct 25, 2023

Conversation

nutritiousemployee
Copy link
Contributor

This is a simple added filter that shows any personnel whose age is lower than 13.
The aim is to have an easier way to sort out children without having to display the dates view, and order by birthdate.

The change for PersonnelFilter is in the filters list (row 80), and in the getFilteredInformation method. I had to pass the current date in the method as I couldn't find a way to retrieve that info from inside the method's switch.
The PersonnelTab only change should be on row 283, but the automated diff shows space changes in the whole file - not sure why as I'm using the suggested IDE settings.

Having changed getFilteredInformation there's two changes in PersonnelMarketDialog and RetirementDefectionDialog since they were calling the method as well. I believe these changes don't impact the functionality of the two classes.

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.

Looks good, just needs some whitespace changes for readability.

MekHQ/src/mekhq/gui/PersonnelTab.java Outdated Show resolved Hide resolved
@@ -419,7 +419,7 @@ private void filterPersonnel() {
sorter.setRowFilter(new RowFilter<>() {
@Override
public boolean include(Entry<? extends PersonnelTableModel, ? extends Integer> entry) {
return nGroup.getFilteredInformation(entry.getModel().getPerson(entry.getIdentifier()));
return nGroup.getFilteredInformation(entry.getModel().getPerson(entry.getIdentifier()),hqView.getCampaign().getLocalDate());
Copy link
Member

Choose a reason for hiding this comment

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

Style change request: spaces between parameters in parameter lists for readability.

@@ -590,7 +590,7 @@ public boolean include(Entry<? extends RetirementTableModel, ? extends Integer>
&& !rdTracker.getRetirees(contract).contains(person.getId())) {
return false;
} else {
return nGroup.getFilteredInformation(person);
return nGroup.getFilteredInformation(person,hqView.getCampaign().getLocalDate());
Copy link
Member

Choose a reason for hiding this comment

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

Style change request: spaces between parameters in parameter lists for readability.

@nutritiousemployee nutritiousemployee marked this pull request as draft October 24, 2023 19:35
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.

Sorry, one other thing - looks like you've changed all the tabs from 4 to 2 in PersonnelTab and PersonnelFilter, which we don't really want. Let's revert those, and then we'll be good to go.

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Attention: 324 lines in your changes are missing coverage. Please review.

Comparison is base (899db66) 10.63% compared to head (c5464ec) 10.63%.

❗ Current head c5464ec differs from pull request most recent head df54613. Consider uploading reports for the commit df54613 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3771   +/-   ##
=========================================
  Coverage     10.63%   10.63%           
  Complexity     5473     5473           
=========================================
  Files           834      834           
  Lines        113770   113772    +2     
  Branches      17196    17196           
=========================================
+ Hits          12099    12100    +1     
- Misses       100465   100466    +1     
  Partials       1206     1206           
Files Coverage Δ
...HQ/src/mekhq/gui/dialog/PersonnelMarketDialog.java 0.00% <0.00%> (ø)
...rc/mekhq/gui/dialog/RetirementDefectionDialog.java 0.00% <0.00%> (ø)
MekHQ/src/mekhq/gui/enums/PersonnelFilter.java 50.93% <50.70%> (-0.01%) ⬇️
MekHQ/src/mekhq/gui/PersonnelTab.java 0.00% <0.00%> (ø)

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

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@nutritiousemployee nutritiousemployee marked this pull request as ready for review October 24, 2023 21:47
@nutritiousemployee
Copy link
Contributor Author

This should be ready now.
There was also an extra space in PersonnelFilter for line 65 which I'm not sure if it was introduced by me by mistake or no, but it's gone either way

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.

Looks good.

@NickAragua NickAragua merged commit 2541a6b into MegaMek:master Oct 25, 2023
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.

2 participants