Skip to content

Commit

Permalink
MAN-355 fix activity log filter caching issue
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-mills committed Jan 30, 2025
1 parent 1478c21 commit 825ec64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/@types/ActivityLog.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface ActivityLogFiltersResponse extends ActivityLogFilters {
}

export interface ActivityLogCache extends ActivityLogFilters {
crn: string
personActivity: PersonActivity
tierCalculation: TierCalculation
}
2 changes: 2 additions & 0 deletions server/middleware/getPersonActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const getPersonActivity = async (
if (req?.session?.cache?.activityLog) {
const cache: ActivityLogCache | undefined = req.session.cache.activityLog.find(
cacheItem =>
crn === cacheItem.crn &&
keywords === cacheItem.keywords &&
dateFrom === cacheItem.dateFrom &&
dateTo === cacheItem.dateTo &&
Expand All @@ -51,6 +52,7 @@ export const getPersonActivity = async (
const newCache: ActivityLogCache[] = [
...(req?.session?.cache?.activityLog || []),
{
crn,
keywords,
dateFrom,
dateTo,
Expand Down

0 comments on commit 825ec64

Please sign in to comment.