Skip to content

Commit

Permalink
Merge pull request #255 from DestinyItemManager/saved-search
Browse files Browse the repository at this point in the history
Whoopsie on saved searches
  • Loading branch information
bhollis authored Dec 18, 2024
2 parents 74e6658 + fe791fd commit 378c8cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion api/routes/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,6 @@ function consolidateSearchUpdates(updates: (UsedSearchUpdate | SavedSearchUpdate
const u: UpdateSearch = {
query: group[0].payload.query,
type: group[0].payload.type ?? SearchType.Item,
saved: false,
incrementUsed: 0,
};
for (const update of group) {
Expand Down
9 changes: 6 additions & 3 deletions api/stately/searches-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ export interface UpdateSearch {
query: string;
type: SearchType;
/**
* Whether the search should be saved
* Whether the search should be saved. If undefined, the saved status is not
* changed.
*/
saved: boolean;
saved?: boolean;
/** How much to increment the used count by. */
incrementUsed: number;
}
Expand All @@ -143,7 +144,9 @@ export async function updateSearches(
existingSearches.find((s) => s.query === query) ??
newSearch(platformMembershipId, destinyVersion, type, query);
search.usageCount += incrementUsed;
search.saved = saved;
if (saved !== undefined) {
search.saved = saved;
}
search.lastUsage = BigInt(Date.now());
return search;
});
Expand Down

0 comments on commit 378c8cb

Please sign in to comment.