Skip to content

Commit

Permalink
Merge pull request #5211 from bcgov/dev
Browse files Browse the repository at this point in the history
LAN Pages tooltip for CFD personal
  • Loading branch information
divyav-aot authored May 8, 2024
2 parents b32a727 + 1633075 commit ee8ed49
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
5 changes: 4 additions & 1 deletion forms-flow-web/src/components/FOI/Dashboard/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
calculateDaysRemaining,
} from "../../../helper/FOI/helper";
import { StateEnum } from "../../../constants/FOI/statusEnum";
import { MinistryNeedsLANPages, RequestTypes } from "../../../constants/FOI/enum";
import Chip from "@mui/material/Chip";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faFlag } from '@fortawesome/free-solid-svg-icons';
Expand Down Expand Up @@ -295,12 +296,14 @@ export const pagecountcellTooltipRender = (params) => {
const recordspagecount = params.row.recordspagecount;
const requestpagecount = params.row.requestpagecount;
const lanpagecount = params.row.axislanpagecount;
const bcgovcode = params.row.bcgovcode;
const requestType = params.row.requestType;
let toolTipText = "";
if (requestpagecount > 0 || lanpagecount > 0) {
if (requestpagecount > 0) {
toolTipText += `AXIS pages: ${axispagecount} \n Mod pages: ${recordspagecount} \n`;
}
if (lanpagecount > 0) {
if (MinistryNeedsLANPages.includes(bcgovcode?.toUpperCase()) && requestType?.toLowerCase() === RequestTypes.personal) {
toolTipText += `LAN pages: ${lanpagecount} \n`;
}
}
Expand Down
12 changes: 12 additions & 0 deletions forms-flow-web/src/constants/FOI/enum.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ const MinistryNeedsScanning = [
"MSD"
]

const MinistryNeedsLANPages = [
"CFD",
"MCF"
]

const RequestTypes = Object.freeze({
general: "general",
personal: "personal"
});

const MCFPopularSections = 23
const MSDPopularSections = 11

Expand Down Expand Up @@ -206,4 +216,6 @@ MSDPopularSections,
RecordsDownloadList,
RecordDownloadCategory,
RecordDownloadStatus,
MinistryNeedsLANPages,
RequestTypes
};
2 changes: 1 addition & 1 deletion request-management-api/request_api/schemas/foiaxissync.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Meta: # pylint: disable=too-few-public-methods
"""Exclude unknown fields in the deserialized output."""

unknown = EXCLUDE
bcgovcode = fields.Str(data_key="bcgovcode",allow_none=False)
iaocode = fields.Str(data_key="iaocode",allow_none=False)
requesttype = fields.Str(data_key="requesttype",allow_none=False)

class FOIRequestAxisSyncSchema(Schema):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class axissyncservice:

def syncpagecounts(self, axispgmrequests):
for entry in axispgmrequests:
self.__syncpagecounts(entry["bcgovcode"], entry["requesttype"])
self.__syncpagecounts(entry["iaocode"], entry["requesttype"])
return DefaultMethodResult(True,'Batch execution completed', axispgmrequests)

def __syncpagecounts(self, bcgovcode, requesttype):
programeara = programareaservice().getprogramareabyiaocode(bcgovcode)
def __syncpagecounts(self, iaocode, requesttype):
programeara = programareaservice().getprogramareabyiaocode(iaocode)
requests = FOIMinistryRequest.getrequest_by_pgmarea_type(programeara['programareaid'], requesttype)
for batch in list(more_itertools.batched(requests, self.AXIS_SYNC_BATCHSIZE)):
batchrequest = list(batch)
Expand All @@ -35,7 +35,7 @@ def __syncpagecounts(self, bcgovcode, requesttype):
print("batch update failed for ids=", axisids)
else:
print("axis page response is empty for ids=", axisids)
return DefaultMethodResult(True,'Batch execution completed for bcgovcode=%s | requesttype=%s', bcgovcode, requesttype)
return DefaultMethodResult(True,'Batch execution completed for iaocode=%s | requesttype=%s', iaocode, requesttype)


def axis_getpageinfo(self, axis_payload):
Expand Down

0 comments on commit ee8ed49

Please sign in to comment.