Files
HRM-System/docs/PLAN-clear-attendance.md

2.3 KiB

PLAN: Clear All Attendance Records

Overview

The user reported that the calendar is now showing 'P' (Present) across the board. This is because the database was populated with hundreds of empty attendance records (with status = 'present' but no clock-in/out times). Now that the calendar correctly reflects the database status, it reveals that these ghost records exist. The objective is to safely wipe these records so the calendar returns to its default state ("--" or "Not Marked") when no actual attendance data has been inputted.

Project Type

BACKEND / DATABASE

Success Criteria

  1. The attendance_records table is completely cleared of all current data.
  2. The calendar properly displays -- (Not Marked) for regular working days, RD for Rest Days, and W for Weekends, reflecting a clean slate.
  3. No employee has residual ghost attendance records.

Tech Stack

  • Laravel (Artisan / Database Facade)
  • MySQL

File Structure

  • database (Direct SQL manipulation)

Task Breakdown

Task 1: Truncate Attendance Records Table

  • Agent: database-architect
  • Description: Safely execute a database query to truncate the attendance_records table.
  • INPUT: Execute TRUNCATE TABLE attendance_records; via Laravel Artisan or direct DB connection.
  • OUTPUT: All 590+ ghost records are removed.
  • VERIFY: Run a SELECT count(*) to confirm the table is empty.

Task 2: Verify Calendar Display State

  • Agent: frontend-specialist
  • Description: Verify the frontend UI correctly handles the empty database.
  • INPUT: Load the HR Attendance Calendar.
  • OUTPUT: The grid should show -- for empty days, proving that the fallback logic for non-existent records works perfectly.
  • VERIFY: Visual confirmation on the frontend.

PHASE X: Verification

  • Database is empty for attendance.
  • UI shows no data correctly.

Warning

Socratic Gate (User Input Required) Before I proceed with executing this plan to wipe the database table, I need you to confirm:

  1. Are you absolutely sure you want to delete ALL existing attendance records in the database? This action is irreversible.
  2. Do you have any real/valid attendance data mixed in with the ghost records that needs to be preserved, or is it safe to wipe the entire table?