Skip to content

prod#133

Merged
DuckySoLucky merged 18 commits into
prodfrom
dev
Apr 3, 2025
Merged

prod#133
DuckySoLucky merged 18 commits into
prodfrom
dev

Conversation

@DuckySoLucky
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 3, 2025 13:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a variety of improvements and fixes across the stats, items, and helper modules, with adjustments to value calculations, logging, and optional result handling. Key updates include improved naming and type conversion for enrichment and color values, modifications to branch conditions and error logging, and changes to the getUsername API to optionally return null.

Reviewed Changes

Copilot reviewed 17 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/lib/server/stats/missing.ts Renamed variable for enrichment and applied a mapping from constants.
src/lib/server/stats/misc.ts Adjusted optional chaining for consistent access of nested properties.
src/lib/server/stats/members.ts Updated getUsername call to include a new option (returnNull).
src/lib/server/stats/items/processing.ts Changed type conversion for color and updated branch condition from "storage_icons" to "backpack".
src/lib/server/stats/items.ts Added networth calculation for backpack items and simplified error logging.
src/lib/server/stats/garden.ts Updated optional chaining on garden commission data references.
src/lib/server/stats/collections.ts Modified getUsername invocation with the new returnNull option.
src/lib/server/stats.ts Removed redundant timing and debug logging for cache hits.
src/lib/server/lib.ts Strengthened null checking in username resolution and added caching for empty garden data on error.
src/lib/server/helper/renderer.ts Introduced caching of rendered items using Redis.
src/lib/server/constants/update-collections.ts Removed extraneous logging.
src/lib/server/constants/accessories.ts Added ENRICHMENT_TO_STAT mapping for accessories.
Files not reviewed (8)
  • src/lib/components/Item.svelte: Language not supported
  • src/lib/components/header/Info.svelte: Language not supported
  • src/lib/components/item/item-content.svelte: Language not supported
  • src/lib/layouts/stats/AdditionalStats.svelte: Language not supported
  • src/lib/layouts/stats/PlayerProfile.svelte: Language not supported
  • src/lib/sections/stats/Accessories.svelte: Language not supported
  • src/lib/sections/stats/Dungeons.svelte: Language not supported
  • src/lib/sections/stats/farming/garden.svelte: Language not supported
Comments suppressed due to low confidence (6)

src/lib/server/stats/members.ts:9

  • Adding the 'returnNull: true' option changes the contract of getUsername. Please verify that all consumers of the username value handle a possible null return to avoid unexpected errors.
username: await getUsername(member, { cache: true, returnNull: true }),

src/lib/server/stats/items/processing.ts:130

  • The double cast to convert the color value to a number might hide type issues. Consider enforcing the correct type earlier in the data flow instead of relying on forceful casting.
const hex = (item.tag.display.color as unknown as number).toString(16).padStart(6, "0");

src/lib/server/stats/items/processing.ts:151

  • Changing the condition from 'storage_icons' to 'backpack' alters the branch logic. Verify that this change reflects the intended filtering of sources.
if (source.startsWith("backpack") === false) {

src/lib/server/stats/collections.ts:75

  • The modified getUsername call now may return null, which could lead to null entries in cachedUsernames. Please confirm that downstream logic properly handles these null values.
cachedUsernames[member] = await getUsername(member, { cache: true, returnNull: true });

src/lib/server/lib.ts:105

  • The updated resolveUsernameOrUUID function now returns null when options.returnNull is true. Ensure that all callers of getUsername and resolveUsernameOrUUID are updated to handle null values appropriately.
if (options.returnNull) {

src/lib/server/lib.ts:201

  • Caching an empty object when garden data fetch fails may lead to stale or misleading results. Verify that this behavior is intended, or consider an alternative error handling strategy.
REDIS.SETEX(`GARDEN:${profileId}`, 60 * 5, JSON.stringify({}));

Comment thread src/lib/server/stats/items.ts
@DuckySoLucky DuckySoLucky merged commit f377df0 into prod Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants