Class DashboardController

java.lang.Object
fr.utc.miage.sporttrack.controller.DashboardController

@Controller public class DashboardController extends Object
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 Details

    • TOTAL_DURATION

      public static final String TOTAL_DURATION
      Attribute key for total duration in weekly aggregates.
      See Also:
    • ACTIVITY_COUNT

      public static final String ACTIVITY_COUNT
      Attribute key for activity count in weekly aggregates.
      See Also:
    • TOTAL_DISTANCE

      public static final String TOTAL_DISTANCE
      Attribute key for total distance in weekly aggregates.
      See Also:
    • TOTAL_REPETITION

      public static final String TOTAL_REPETITION
      Attribute key for total repetitions in weekly aggregates.
      See Also:
    • WEEK_NUMBER

      public static final String WEEK_NUMBER
      Attribute key for the ISO week number in weekly aggregates.
      See Also:
    • ATHLETE_ATTR

      public static final String ATHLETE_ATTR
      See Also:
  • Constructor Details

    • DashboardController

      public DashboardController(ActivityService activityService, ObjectiveService objectiveService, SportService sportService, AthleteRepository athleteRepository)
      Constructs a DashboardController with the required dependencies.
      Parameters:
      activityService - the activity service
      objectiveService - the objective service
      sportService - the sport service
      athleteRepository - 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 resolution
      model - the Spring MVC model
      sportId - optional sport identifier for filtering activities and objectives
      startDate - optional inclusive start date for the filter range
      endDate - 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 resolution
      model - the Spring MVC model
      sportId - optional sport identifier for filtering
      Returns:
      the view name "dashboard/growth", or a redirect to login if unauthenticated