-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(condo): DOMA-8523 added filter for expired tickets. Added saving previous query params for pages #4571
Conversation
a8227c8
to
475c0bf
Compare
} | ||
}, [checkboxValueFromQuery]) | ||
|
||
return [value, handleChangeCheckbox, handleResetCheckboxWithoutUpdateQuery, handleChangeCheckboxWithoutUpdateQuery] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe return a object?
It's not clear what returns from hook without read the hook code
const reduceNonEmpty = (cnt, filter) => cnt + Number((typeof filters[filter] === 'string' || Array.isArray(filters[filter])) && filters[filter].length > 0) | ||
const appliedFiltersCount = Object.keys(filters).reduce(reduceNonEmpty, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memo?
OR: [ | ||
{ AND: { status: { type_in: [COMPLETED_STATUS_TYPE, CLOSED_STATUS_TYPE] }, isCompletedAfterDeadline: true } }, | ||
{ AND: { status: { type_in: [NEW_OR_REOPENED_STATUS_TYPE, PROCESSING_STATUS_TYPE] }, deadline_lt: (new Date()).toISOString() } }, | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about deffered status?
apps/condo/pages/employee/index.tsx
Outdated
const canManageEmployee = get(link, 'role.canInviteNewOrganizationEmployees', null) | ||
const employeeId = get(link, 'id') | ||
|
||
usePreviousQueryParams({ trackedParamNames: ['sort', 'filters'], employeeId }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Behavior with saving filters is needed on all pages with filters?
Mb move it to some Context
, use it in _app
and not not copy paste this logic everywhere where we need filters?
type usePreviousQueryParamsType = (props: { trackedParamNames: Array<string>, delimitersParamNames?: Array<string>, employeeId?: string }) => void | ||
|
||
export const usePreviousQueryParams: usePreviousQueryParamsType = ({ | ||
delimitersParamNames, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s not clear from the name of the argument what it’s responsible for.
Mb tab
or some other name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of a good name for this variable. Changed it to paramNamesForPageChange
and added a docs
475c0bf
to
eab2c0a
Compare
// // Case without tabs | ||
// useEffect(() => { | ||
// if (!employeeId) return | ||
// if (withDelimitersParams) return | ||
// applyQueryParamsFromLocalStorage() | ||
// }, [employeeId]) | ||
// useDeepCompareEffect(() => { | ||
// if (!employeeId) return | ||
// if (withDelimitersParams) return | ||
// saveQueryParamsToLocalStorage() | ||
// }, [employeeId, trackedParams]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you comment it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted this. Was updated logic
export const usePreviousQueryParams: usePreviousQueryParamsType = ({ | ||
delimitersParamNames, | ||
employeeId, | ||
trackedParamNames, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
Also you can wrap this hook in less common hook, specified to save filters logic and use default params there
@@ -775,16 +785,16 @@ const Ticket = new GQLListSchema('Ticket', { | |||
if (resolvedStatusId) { | |||
calculateTicketOrder(resolvedData, resolvedStatusId) | |||
|
|||
const existedStatusId = get(existingItem, 'status', null) | |||
const resolvedStatus = await TicketStatus.getOne(context, { id: resolvedStatusId }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use here getById
?
And below in existedStatus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try
expect(updatedTicket8).toHaveProperty('isCompletedAfterDeadline', true) | ||
}) | ||
|
||
test('Should be auto-set false if status changed to "completed", "closed" or "closed" before deadline', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test('Should be auto-set false if status changed to "completed", "closed" or "closed" before deadline', async () => { | |
test('Should be auto-set false if status changed to "completed", "closed" or "canceled" before deadline', async () => { |
let stopPoint | ||
|
||
if (nextStatusId === STATUS_IDS.DECLINED) { | ||
if ((prevStatusId === STATUS_IDS.COMPLETED || prevStatusId === STATUS_IDS.CLOSED || nextStatusId === STATUS_IDS.DECLINED) && completedAt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you check nextStatusId === STATUS_IDS.DECLINED
twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} else if (nextStatusId === STATUS_IDS.COMPLETED) { | ||
stopPoint = completedAt | ||
} else if (nextStatusId === STATUS_IDS.CLOSED) { | ||
if ((prevStatusId === STATUS_IDS.COMPLETED || nextStatusId === STATUS_IDS.CLOSED) && completedAt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also for nextStatusId === STATUS_IDS.CLOSED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
2ffd950
to
52fe86b
Compare
…le. Refactored page of meter
…tton for reset filters
…d. Fixed calculate "completedAt"
52fe86b
to
3691a44
Compare
Quality Gate passedIssues Measures |
isCompletedAfterDeadline
field was addedcondo
andcallcenter
apps. Miniapps will be updated in another pr)And little demo videos
Added filter for expired tickets and saving previous query params for pages
Before
2024-04-04.15.38.00.mov
After
2024-04-04.15.35.39.mov
Updated search behavior in multi-selects
Before
2024-04-04.15.38.36.mov
After
2024-04-04.15.36.44.mov