Skip to content

Implement Student CSV Bulk Import #943

@americac

Description

@americac

!!! Blocked By: #941 !!!

Description:
Add CSV bulk import functionality for Students with error reporting.

Tasks:

  • Update Admin::StudentsController:
    • Add import action to handle CSV upload
    • Use BulkStudentImportService.import_from_csv
    • Validate file presence and format
    • Partition results (success/errors)
    • Build detailed error messages
    • Return results via flash messages
  • Add template action to generate CSV template download
  • Update index view:
    • Add import button to header
    • Create import modal with form
    • Show CSV requirements: "columns: classroom_id, username"
    • Add template download button
    • Implement JavaScript modal toggle

Acceptance Criteria:

  • Import button opens modal
  • Modal shows CSV requirements clearly
  • Template download generates correct CSV format
  • File upload accepts CSV files
  • Import processes CSV using BulkStudentImportService
  • Success count displayed after import
  • Error messages display per-row details
  • Modal closes after successful import
  • Validation errors shown for missing file
  • Flash messages styled correctly

Files to Update:

  • app/views/admin/students/index.html.erb

Reference:

  • app/controllers/admin/students_controller.rb (lines 17-40, 60-62)
  • app/views/admin/students/index.html.erb (current - modal markup)
  • app/services/bulk_student_import_service.rb

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedIssue blocked by another issue

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions