Skip to content

Commit

Permalink
fix unit strength counter to ignore duplicates (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
SyniRon authored Sep 11, 2023
1 parent 2149bfc commit c915326
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions client/src/modules/Generic/MilpacParse.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";

function MilpacParse(props) {
const uniqueNamesSet = new Set();
var array = [];
var milpacArray = props.milpacArray;
var billetIDs = props.billetIDs;
Expand All @@ -25,6 +26,7 @@ function MilpacParse(props) {
itemKey: milpacIdCombat,
listKey: primarySortKey + milpacIdCombat,
});
uniqueNamesSet.add(fullName);
}

for (var index in milpacArray[0].combat.profiles[milpacIdCombat]
Expand All @@ -47,6 +49,7 @@ function MilpacParse(props) {
itemKey: milpacIdCombat,
listKey: secondarySortKey + milpacIdCombat,
});
uniqueNamesSet.add(fullName);
}
}

Expand All @@ -68,6 +71,7 @@ function MilpacParse(props) {
itemKey: milpacIdReserve,
listKey: rPrimarySortKey + milpacIdReserve,
});
uniqueNamesSet.add(rFullName);
}

for (var rIndex in milpacArray[0].reserve.profiles[milpacIdReserve]
Expand All @@ -90,6 +94,7 @@ function MilpacParse(props) {
itemKey: milpacIdReserve,
listKey: rSecondarySortKey + milpacIdReserve,
});
uniqueNamesSet.add(rFullName);
}
}

Expand All @@ -104,7 +109,7 @@ function MilpacParse(props) {
<div className="ResponseContainer">
<div className="HeaderContainer">
<div className="Subtitle">{subtitle}</div>
<div className="Counter">Unit Strength: {array.length}</div>
<div className="Counter">Unit Strength: {uniqueNamesSet.size}</div>
</div>
<div className="ItemList">
<table>
Expand Down Expand Up @@ -152,6 +157,7 @@ function MilpacParse(props) {
itemKey: milpacIdCombat,
listKey: primarySortKey + milpacIdCombat,
});
uniqueNamesSet.add(fullName);
}
}

Expand All @@ -166,7 +172,7 @@ function MilpacParse(props) {
<div className="ResponseContainer">
<div className="HeaderContainer">
<div className="Subtitle">{subtitle}</div>
<div className="Counter">Unit Strength: {array.length}</div>
<div className="Counter">Unit Strength: {uniqueNamesSet.size}</div>
</div>
<div className="ItemList">
<table>
Expand Down

0 comments on commit c915326

Please sign in to comment.