Class DashboardController
java.lang.Object
fr.utc.miage.sporttrack.controller.DashboardController
Spring MVC controller for the athlete dashboard views.
Provides endpoints for the comparison dashboard (activity and objective statistics with sport/date filtering) and the growth dashboard (weekly trends, consecutive active weeks, and monthly KPIs).
- Author:
- SportTrack Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAttribute key for activity count in weekly aggregates.static final Stringstatic final StringAttribute key for total distance in weekly aggregates.static final StringAttribute key for total duration in weekly aggregates.static final StringAttribute key for total repetitions in weekly aggregates.static final StringAttribute key for the ISO week number in weekly aggregates. -
Constructor Summary
ConstructorsConstructorDescriptionDashboardController(ActivityService activityService, ObjectiveService objectiveService, SportService sportService, AthleteRepository athleteRepository) Constructs aDashboardControllerwith the required dependencies. -
Method Summary
Modifier and TypeMethodDescriptionshowDashboard(jakarta.servlet.http.HttpSession session, org.springframework.ui.Model model, Integer sportId, LocalDate startDate, LocalDate endDate) Renders the comparison dashboard with activity and objective statistics, optionally filtered by sport and date range.showGrowth(jakarta.servlet.http.HttpSession session, org.springframework.ui.Model model, Integer sportId) Renders the growth dashboard showing weekly activity trends, consecutive active weeks, and monthly hour KPIs.
-
Field Details
-
TOTAL_DURATION
Attribute key for total duration in weekly aggregates.- See Also:
-
ACTIVITY_COUNT
Attribute key for activity count in weekly aggregates.- See Also:
-
TOTAL_DISTANCE
Attribute key for total distance in weekly aggregates.- See Also:
-
TOTAL_REPETITION
Attribute key for total repetitions in weekly aggregates.- See Also:
-
WEEK_NUMBER
Attribute key for the ISO week number in weekly aggregates.- See Also:
-
ATHLETE_ATTR
- See Also:
-
-
Constructor Details
-
DashboardController
public DashboardController(ActivityService activityService, ObjectiveService objectiveService, SportService sportService, AthleteRepository athleteRepository) Constructs aDashboardControllerwith the required dependencies.- Parameters:
activityService- the activity serviceobjectiveService- the objective servicesportService- the sport serviceathleteRepository- the athlete repository
-
-
Method Details
-
showDashboard
@GetMapping("/dashboard") public String showDashboard(jakarta.servlet.http.HttpSession session, org.springframework.ui.Model model, @RequestParam(required=false) Integer sportId, @RequestParam(required=false) @DateTimeFormat(iso=DATE) LocalDate startDate, @RequestParam(required=false) @DateTimeFormat(iso=DATE) LocalDate endDate) Renders the comparison dashboard with activity and objective statistics, optionally filtered by sport and date range.- Parameters:
session- the HTTP session for athlete resolutionmodel- the Spring MVC modelsportId- optional sport identifier for filtering activities and objectivesstartDate- optional inclusive start date for the filter rangeendDate- optional inclusive end date for the filter range- Returns:
- the view name "dashboard/compare", or a redirect to login if unauthenticated
-
showGrowth
@GetMapping("/growth") public String showGrowth(jakarta.servlet.http.HttpSession session, org.springframework.ui.Model model, @RequestParam(required=false) Integer sportId) Renders the growth dashboard showing weekly activity trends, consecutive active weeks, and monthly hour KPIs.- Parameters:
session- the HTTP session for athlete resolutionmodel- the Spring MVC modelsportId- optional sport identifier for filtering- Returns:
- the view name "dashboard/growth", or a redirect to login if unauthenticated
-