Skip to content

[Feature Request]: Add rating range filter to the Problem Explorer #6

Description

@Sandesh282

Description:

The Problem List currently supports filtering by text search and tag selection, but there is no way to filter problems by difficulty rating. For competitive programmers, filtering by rating range (e.g., 800–1200) is essential for targeted practice sessions.

Feature Requirements:

  • Add a set of rating range chip buttons near the existing tag filter bar (e.g., [800-1000], [1000-1200], [1200-1400], [1400-1800], [1800+]).
  • Tapping a chip selects it (highlighted with the neon gradient). Tapping again deselects it.
  • The rating filter should work in combination with the existing text search and tag filter.
  • Problems with a nil rating should be excluded when a rating range is active.
  • When no rating range is selected, all problems are displayed (preserving current behavior).

Steps to Implement:

  1. Add a @State private var selectedRatingRange property in ProblemListView.
  2. Create rating chip UI components below the tag filter bar, following the same visual style as the existing tag chips.
  3. Update ProblemFilterEngine.filter() in CForge/Domain/ProblemFilterEngine.swift to accept an optional rating range parameter.
  4. Update ProblemListViewModel.filterProblems() in CForge/ViewModels/ProblemListViewModel.swift to pass the rating range through.
  5. Wire the UI state to trigger filtering via the existing .task(id:) pattern.

Key Files:

File Change
CForge/Domain/ProblemFilterEngine.swift Add rating range filtering logic
CForge/ViewModels/ProblemListViewModel.swift Update filterProblems() method signature
CForge/Views/Problem/ProblemListView.swift Add rating chip UI and state management

Expected Outcome:

  • Users can filter problems by selecting a rating range chip.
  • The filter integrates seamlessly with the existing search and tag filters.
  • The UI is consistent with the app's neon dark theme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions