Skip to content

Implement Drill Variation Feature #46

@austeane

Description

@austeane

We need to implement a feature that allows users to mark drills as variations of each other. This will enhance the interconnectedness of drills and improve user experience by allowing easier discovery of related drills.

Tasks:

  1. Database Changes:

    • Create a new table drill_variations with the following structure:
      • id (Primary Key)
      • drill_id_1 (Foreign Key to drills table)
      • drill_id_2 (Foreign Key to drills table)
      • Add a unique constraint on (drill_id_1, drill_id_2)
      • Add a check constraint to ensure drill_id_1 < drill_id_2
    • Create a migration file for this new table
  2. Backend API Changes:

    • Update src/routes/drills/[id]/+page.server.js:
      • Modify the load function to fetch variations along with drill details
    • Create new API endpoints:
      • GET /api/drills/:id/variations: Fetch variations for a specific drill
      • POST /api/drills/:id/variations: Add a new variation
    • Implement a search endpoint for drills: GET /api/drills/search
  3. Frontend Changes:

    • Update src/routes/drills/[id]/+page.svelte:
      • Add a section to display variations (lines 128-150)
      • Implement a "Mark as Variation" button and modal (lines 577-601)
    • Create a new component src/lib/components/VariationModal.svelte for the variation selection modal
    • Update src/routes/drills/+page.svelte to display variation information in the drill listing
  4. Implement Variation Logic:

    • Create functions to handle adding and removing variations
    • Implement search functionality for finding drills to mark as variations
    • Ensure proper error handling and validation
  5. UI/UX Considerations:

    • Design and implement a user-friendly interface for marking drills as variations
    • Ensure the variation section is easily discoverable on the drill details page
    • Implement proper loading states and error messages
  6. Testing:

    • Write unit tests for new API endpoints
    • Update existing tests to account for the new variation feature
    • Implement end-to-end tests for the variation marking process
  7. Documentation:

    • Update API documentation to include new endpoints
    • Add user guide information about the variation feature
  8. Performance Considerations:

    • Ensure efficient querying of variations, especially for drills with many variations
    • Implement pagination if necessary for displaying variations

Additional Notes:

  • Ensure that the implementation follows our existing code style and best practices
  • Consider future scalability, especially if the number of variations grows large
  • Coordinate with the UX team to ensure the new feature aligns with overall app design

Related files:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions