Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Main v2#39

Merged
jemiluv8 merged 5 commits intomainfrom
main-v2
Jul 20, 2025
Merged

Main v2#39
jemiluv8 merged 5 commits intomainfrom
main-v2

Conversation

@jemiluv8
Copy link
Owner

Bugfixes

jemiluv8 added 5 commits July 20, 2025 21:36
I figured out that my new way of generating summary items requires all old summaries to be regenerated.
…ction

  parameters

  ## Summary
  Replaced the complex Aliased() method pattern with simplified direct methods
  to improve code readability and eliminate the need for function parameters.

  ## Key Changes

  ### API Simplification
  - Add RetrieveWithAliases() and SummarizeWithAliases() methods to ISummaryService
  - Implement simplified methods that internally call Aliased() with appropriate
  functions
  - Update 10+ call sites across the codebase to use new simplified API

  ### Before (ceremonious):
  ```go
  summary, err := a.services.Summary().Aliased(
      interval[0], interval[1], user,
      a.services.Summary().Retrieve,  // Function parameter!
      filters, end.After(time.Now())
  )

  After (simplified):

  summary, err := a.services.Summary().RetrieveWithAliases(
      interval[0], interval[1], user,
      filters, end.After(time.Now())
  )

  Files Modified

  - services/services.go: Add new methods to ISummaryService interface
  - services/summary.go: Implement RetrieveWithAliases and SummarizeWithAliases
  - mocks/summary_service.go: Add mock implementations for new methods
  - internal/api/compat_summaries.go: Update GetSummaries endpoint
  - internal/api/compat_all_time.go: Update loadUserSummary method
  - internal/api/metrics.go: Update multiple summary calls
  - services/{goal,report,leaderboard,misc,client}.go: Update service calls
  - routes/utils/summary_utils.go: Simplify conditional logic
  - services/summary_test.go: Add comprehensive tests for new methods
  - SUMMARIES.md: Update documentation with API changes

  Benefits

  - Eliminated ceremonious function parameters (95% of calls used same pattern)
  - Improved code readability and self-documentation
  - Reduced cognitive overhead for developers
  - Maintained all existing functionality (caching, aliasing, project labels)
  - Preserved backward compatibility with existing Aliased() method
  - Added comprehensive test coverage

  Testing

  - All existing tests pass
  - Added new tests for RetrieveWithAliases and SummarizeWithAliases methods
  - Verified identical behavior to original Aliased() method calls

  🤖 Generated with [Claude Code](https://claude.ai/code)

  Co-Authored-By: Claude <[email protected]>
@jemiluv8 jemiluv8 merged commit 46769a4 into main Jul 20, 2025
6 checks passed
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.

1 participant