AdvantageCalculatorService
Component Detail
Description
Performs the business logic for computing advantage metrics from a volunteer's activity logs. Aggregates raw activity data into impact statements covering professional hours equivalent, cost savings, and social contribution scores. Exposes calculation results to the UI layer and supports both automatic retrieval and manual data input scenarios.
advantage-calculator-service
Sources & reasoning
The Advantage Calculator is named explicitly in the Phase 3 roadmap at line 353 as part of the gamification cluster. Line 364-365 directly confirms it belongs to the Achievements & Gamification area and follows Phase 3. No earlier phase reference exists, and the feature is not marked must-have, so Phase 3 normalizes to v1.1.
-
docs/source/likeperson.md · line 353Gamification / «Ditt likepersonsÄr» (Wrapped, badges, Advantage Calculator)
-
docs/source/likeperson.md · line 364-365Fordelskalkulator (Advantage Calculator) ligger inne i Achievements & Gamification-omrÄdet og fÞlger derfor Fase 3.
Responsibilities
- Retrieve and aggregate activity history for a given user
- Apply calculation formulas to produce impact metrics (hours, cost savings, social score)
- Accept manual activity input and incorporate it into calculations
- Format calculated metrics into structured advantage result objects
- Cache calculation results to reduce redundant processing
Interfaces
calculateAdvantage(userId: string): AdvantageMetrics
getActivityHistory(userId: string): ActivityLog[]
addManualActivity(userId: string, activity: ManualActivityInput): void
formatImpactStatement(metrics: AdvantageMetrics): ImpactStatement
Related Data Entities (3)
Data entities managed by this component