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

Test marshal st 4652 #595

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions web/src/components/FOI/Home/DocumentSelector.scss
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@
color: #808080;
}

.MuiTreeItem-content.Mui-selected {
background-color: rgba(25, 118, 210, 0.4) !important;
}

.MuiTreeItem-content:hover {
background-color: rgba(25, 118, 210, 0.2) !important
}

.filterIcons {
color: #808080;
margin-right: 10px;
Expand Down
107 changes: 55 additions & 52 deletions web/src/components/FOI/Home/Redlining.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ const Redlining = React.forwardRef(
(state) => state.documents?.requestnumber
);

document.title = requestnumber + " - FOI Document Reviewer"

const pageFlags = useAppSelector((state) => state.documents?.pageFlags);
const redactionInfo = useSelector(
(state) => state.documents?.redactionInfo
Expand Down Expand Up @@ -1282,7 +1284,7 @@ const Redlining = React.forwardRef(
childAnnotation.X = _redact.X;
childAnnotation.Y = _redact.Y;
childAnnotation.FontSize =
Math.min(parseInt(_redact.FontSize), 12) + "pt";
Math.min(parseInt(_redact.FontSize), 9) + "pt";
const fullpageredaction = _redact.getCustomData("trn-redaction-type");
const displayedDoc =
pageMappedDocs.stitchedPageLookup[Number(node.attributes.page) + 1];
Expand Down Expand Up @@ -1651,7 +1653,7 @@ const Redlining = React.forwardRef(
_annot.PageNumber = _redaction?.getPageNumber();
_annot.X = X || _redaction.X;
_annot.Y = _redaction.Y;
_annot.FontSize = Math.min(parseInt(_redaction.FontSize), 12) + "pt";
_annot.FontSize = Math.min(parseInt(_redaction.FontSize), 9) + "pt";
return _annot;
};

Expand Down Expand Up @@ -2055,49 +2057,56 @@ const Redlining = React.forwardRef(
const prepareRedlinePageMapping = (divisionDocuments, redlineSinglePkg) => {
let removepages = {};
let pageMappings = {};
let pagesToRemove = [];
let pagesToRemove = [];
let totalPageCount = 0;
let totalPageCountIncludeRemoved = 0;
let divisionCount = 0;
for (let divObj of divisionDocuments) {
divisionCount++;
let divisionCount = 0;
for (let divObj of divisionDocuments) {
divisionCount++;
for (let doc of divObj.documentlist) {
let pagesToRemoveEachDoc = [];
pageMappings[doc.documentid] = {};
//gather pages that need to be removed
doc.pageFlag.sort((a, b) => a.page - b.page); //sort pageflag by page #
for (const flagInfo of doc.pageFlag) {
if (
flagInfo.flagid == pageFlagTypes["Duplicate"] ||
flagInfo.flagid == pageFlagTypes["Not Responsive"]
) {
pagesToRemoveEachDoc.push(flagInfo.page);
pagesToRemove.push(flagInfo.page + totalPageCountIncludeRemoved);
} else {
pageMappings[doc.documentid][flagInfo.page] =
flagInfo.page + totalPageCount - pagesToRemoveEachDoc.length;
//gather pages that need to be removed
doc.pageFlag.sort((a, b) => a.page - b.page); //sort pageflag by page #
if(isIgnoredDocument(doc, doc['pagecount'], divisionDocuments) == false) {
for (const flagInfo of doc.pageFlag) {
if (
flagInfo.flagid == pageFlagTypes["Duplicate"] ||
flagInfo.flagid == pageFlagTypes["Not Responsive"]
) {
pagesToRemoveEachDoc.push(flagInfo.page);
pagesToRemove.push(
flagInfo.page + totalPageCountIncludeRemoved
);
} else {
pageMappings[doc.documentid][flagInfo.page] =
flagInfo.page +
totalPageCount -
pagesToRemoveEachDoc.length;
}
}
//End of pageMappingsByDivisions
totalPageCount += Object.keys(
pageMappings[doc.documentid]
).length;
totalPageCountIncludeRemoved += doc.pagecount;
}
//End of pageMappingsByDivisions
totalPageCount += Object.keys(pageMappings[doc.documentid]).length;
totalPageCountIncludeRemoved += doc.pagecount;

}
if (redlineSinglePkg == "Y") {
if (divisionCount == divisionDocuments.length) {
removepages["0"] = pagesToRemove;
removepages['0'] = pagesToRemove;
}
} else {
removepages[divObj.divisionid] = pagesToRemove;
pagesToRemove = [];
totalPageCount = 0;
totalPageCountIncludeRemoved = 0;
}
}

}
setRedlinepageMappings({
pagemapping: pageMappings,
pagestoremove: removepages,
});
};
setRedlinepageMappings({'pagemapping': pageMappings, 'pagestoremove': removepages})
}

const prepareRedlineIncompatibleMapping = (redlineAPIResponse) => {
let divIncompatableMapping = {};
Expand All @@ -2107,7 +2116,7 @@ const Redlining = React.forwardRef(
for (let divObj of redlineAPIResponse.divdocumentList) {
divCounter++;
let incompatableObj = {};
incompatableObj["incompatableFiles"] = [];
incompatableObj["incompatibleFiles"] = [];
if (divObj.incompatableList.length > 0) {
const divIncompatableFiles = divObj.incompatableList
.filter((record) =>
Expand All @@ -2121,7 +2130,7 @@ const Redlining = React.forwardRef(
s3uripath: record.filepath,
};
});
incompatibleFiles.concat(divIncompatableFiles);
incompatibleFiles = incompatibleFiles.concat(divIncompatableFiles);
}
if (redlineAPIResponse.issingleredlinepackage == "Y") {
if (divCounter == redlineAPIResponse.divdocumentList.length) {
Expand Down Expand Up @@ -2161,25 +2170,23 @@ const Redlining = React.forwardRef(
}
};

const isIgnoredDocument = (doc, docObj, divisionDocuments) => {
const isIgnoredDocument = (doc, pagecount, divisionDocuments) => {
const divdocumentlist = JSON.parse(JSON.stringify(divisionDocuments));
let removepagesCount = 0;
for (let divsionentry of divdocumentlist) {
for (let docentry of divsionentry["documentlist"]) {
if (doc.documentid == docentry.documentid) {
for (const flagInfo of docentry.pageFlag) {
if (
flagInfo.flagid == pageFlagTypes["Duplicate"] ||
flagInfo.flagid == pageFlagTypes["Not Responsive"]
) {
removepagesCount++;
}
for (let docentry of divsionentry['documentlist']) {
if (doc.documentid == docentry.documentid) {
for (const flagInfo of docentry.pageFlag) {
if (
flagInfo.flagid == pageFlagTypes["Duplicate"] || flagInfo.flagid == pageFlagTypes["Not Responsive"]
){
removepagesCount++;
}
}
}
}
}
}

return docObj.getPageCount() == removepagesCount;
return pagecount == removepagesCount;
};

const stitchForRedlineExport = async (
Expand Down Expand Up @@ -2214,9 +2221,9 @@ const Redlining = React.forwardRef(
for (let doc of documentlist) {
await _instance.Core.createDocument(doc.s3path_load, {
loadAsPDF: true,
}).then(async (docObj) => {
docCount++;
if (isIgnoredDocument(doc, docObj, divisionDocuments) == false) {
}).then(async (docObj) => {
if (isIgnoredDocument(doc, docObj.getPageCount(), divisionDocuments) == false) {
docCount++;
if (docCount == 1) {
stitchedDocObj = docObj;
} else {
Expand All @@ -2234,11 +2241,7 @@ const Redlining = React.forwardRef(
}
}
});
if (
docCount == documentlist.length &&
redlineSinglePkg == "N" &&
stitchedDocObj != null
) {
if (redlineSinglePkg == "N" && stitchedDocObj != null ) {
requestStitchObject[division] = stitchedDocObj;
}
}
Expand Down Expand Up @@ -2662,7 +2665,7 @@ const Redlining = React.forwardRef(
if (sectionStamps[annot.Id]) {
annotationManager.setAnnotationStyles(annot, {
OverlayText: sectionStamps[annot.Id],
FontSize: Math.min(parseInt(annot.FontSize), 12) + "pt",
FontSize: Math.min(parseInt(annot.FontSize), 9) + "pt",
});
}
}
Expand Down