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

fix(substatus and 2nd clock): Correct rai resp withdraw enabled substatus logic, as well as 2nd clock display #345

Merged
merged 12 commits into from
Jan 25, 2024
16 changes: 16 additions & 0 deletions src/packages/shared-types/opensearch/main/transforms/seatool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ const getFinalDispositionDate = (status: string, record: SeaTool) => {
: null;
};

const isInSecondClock = (data: any) => {
if (
authorityLookup(data.authority) != "CHIP" && // if it's not a chip
[
SEATOOL_STATUS.PENDING,
SEATOOL_STATUS.PENDING_CONCURRENCE,
SEATOOL_STATUS.PENDING_APPROVAL,
].includes(data.seatoolStatus) && // if it's in pending
data.raiReceivedDate // if it's latest rai has a received date
) {
return true; // then we're in second clock
}
return false; // otherwise, we're not
};
mdial89f marked this conversation as resolved.
Show resolved Hide resolved

export const transform = (id: string) => {
return seatoolSchema.transform((data) => {
const { leadAnalystName, leadAnalystOfficerId } = getLeadAnalyst(data);
Expand Down Expand Up @@ -138,6 +153,7 @@ export const transform = (id: string) => {
data.STATE_PLAN.SUBMISSION_DATE
),
subject: data.STATE_PLAN.TITLE_NAME,
secondClock: isInSecondClock(data),
};
});
};
Expand Down
13 changes: 10 additions & 3 deletions src/services/ui/src/components/Opensearch/main/Filtering/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,24 @@ export const EXPORT_GROUPS = (
{
name: "Status",
transform(data) {
let status = BLANK_VALUE;
if (user?.data?.isCms && !user?.data?.user) {
if (data.cmsStatus) {
return data.cmsStatus;
status = data.cmsStatus;
}
return BLANK_VALUE;
} else {
if (data.stateStatus) {
return data.stateStatus;
status = data.stateStatus;
}
return BLANK_VALUE;
}

if (status === BLANK_VALUE) return status;

status += data.raiWithdrawEnabled
? " (Withdraw Formal Rai Response - Enabled)"
: "";
return status;
},
},
{
Expand Down
24 changes: 19 additions & 5 deletions src/services/ui/src/pages/dashboard/Lists/spas/consts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,25 @@ export const useSpaTableColumns = (): OsTableColumn[] => {
{
field: props?.isCms ? "cmsStatus.keyword" : "stateStatus.keyword",
label: "Status",
cell: (data) =>
props?.isCms &&
!(props.user?.["custom:cms-roles"] === UserRoles.HELPDESK)
? data.cmsStatus
: data.stateStatus,
cell: (data) => {
const status = (() => {
if (!props?.isCms) return data.stateStatus;
if (props.user?.["custom:cms-roles"] !== UserRoles.HELPDESK) {
return data.stateStatus;
}
return data.cmsStatus;
})();

const subStatus = data.raiWithdrawEnabled
? "Withdraw Formal RAI Response - Enabled"
: null;
return (
<>
<p>{status}</p>
{!!subStatus && <p className="text-xs opacity-60">{subStatus}</p>}
</>
);
},
},
{
field: "submissionDate",
Expand Down
5 changes: 2 additions & 3 deletions src/services/ui/src/pages/detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const DetailCardWrapper = ({
);
const StatusCard = (data: opensearch.main.Document) => {
const transformedStatuses = getStatus(data.seatoolStatus);
const checker = PackageCheck(data);
const { data: user } = useGetUser();

return (
Expand All @@ -52,12 +51,12 @@ const StatusCard = (data: opensearch.main.Document) => {
? transformedStatuses.cmsStatus
: transformedStatuses.stateStatus}
</h2>
{checker.hasEnabledRaiWithdraw && (
{data.raiWithdrawEnabled && (
<em className="text-xs my-4 mr-2">
{"Withdraw Formal RAI Response - Enabled"}
</em>
)}
{user?.isCms && checker.isInSecondClock && (
{user?.isCms && data.secondClock && (
<span id="secondclock" className="ml-2">
2nd Clock
</span>
Expand Down
Loading