# CHECKLIST: Implementasi Multi-Sesi Absensi ✅

---

## 📦 Deployment Checklist

- [ ] **Backup Database** (recommended)
  ```bash
  # Backup automatic di production
  ```

- [ ] **Sync Code dari Git/Repository**
  - File yang berubah:
    - `app/Models/PresensiPesertaModel.php`
    - `app/Controllers/Scan.php`
  - File baru (dokumentasi):
    - `PANDUAN_SESI_ABSENSI.md`
    - `DOCS_SESI_TEKNIS.md`
    - `IMPLEMENTASI_SESI_SUMMARY.md`
    - `QUICK_REFERENCE_SESI.md`

- [ ] **Verify PHP Syntax**
  ```bash
  php -l app/Models/PresensiPesertaModel.php    # ✅ OK
  php -l app/Controllers/Scan.php                # ✅ OK
  ```

- [ ] **Clear Cache** (jika ada)
  - Bersihkan folder `writable/cache/`
  - Clear browser cache (Ctrl+Shift+Del)

- [ ] **Test Absensi**
  - Buat 2 sesi test
  - Absen peserta sebelum jam_mulai → Success
  - Absen peserta sesudah jam_selesai → Error "Sesi berakhir"
  - Verify pesan error muncul

---

## 👥 User Training Checklist

- [ ] **Admin Training**
  - [ ] Baca: `QUICK_REFERENCE_SESI.md`
  - [ ] Baca: `PANDUAN_SESI_ABSENSI.md` (lengkap)
  - [ ] Praktik: Create 4 sesi test
  - [ ] Praktik: Edit & delete sesi
  - [ ] Verify dropdown di halaman scan

- [ ] **End-User (Peserta) Info**
  - [ ] Pastikan peserta tahu harus pilih sesi saat absen
  - [ ] Ingatkan sistem strict (tidak bisa absen setelah sesi berakhir)
  - [ ] Training QR code scan dengan dropdown sesi

---

## 🔍 Verification Checklist

### Technical

- [ ] No PHP errors di log: `writable/logs/log-*.log`
- [ ] Database structure OK (via phpmyadmin)
  - Table `tb_sesi` exists with correct columns
  - Table `tb_presensi_peserta` has `id_sesi` column

### Functional

- [ ] Admin menu "Sesi" accessible
- [ ] Can create new session
- [ ] Can edit session (change times)
- [ ] Can delete session
- [ ] Session status "Aktif" works
- [ ] QR scan page shows session dropdown
- [ ] Session dropdown populated correctly
- [ ] Attendance validation works:
  - ✅ Before jam_mulai
  - ✅ Between jam_mulai and jam_selesai (with lateness)
  - ❌ After jam_selesai (error message)
- [ ] Duplicate session check works
- [ ] WhatsApp notification includes lateness info

### Data

- [ ] Old attendance data still accessible
- [ ] Reports show session data correctly
- [ ] Filter by session works in attendance reports

---

## 📋 Configuration Checklist

- [ ] **Timezone Setting** (if not already set)
  ```
  File: .env
  Key: app.timezone
  Value: Asia/Jakarta (or your timezone)
  Reason: Validasi jam harus akurat
  ```

- [ ] **Server Time**
  - [ ] Verify server time is correct
  - [ ] Set NTP if available
  - [ ] Common issue: If many "session ended" errors → check server time

- [ ] **Database Indexes** (for performance)
  ```sql
  -- Already exists, but verify:
  SHOW INDEX FROM tb_sesi;
  SHOW INDEX FROM tb_presensi_peserta;
  ```

---

## 🐛 Debugging Checklist (if issues)

### Issue: "Sesi tidak ditemukan"
- [ ] Verify session exists in `tb_sesi` table
- [ ] Verify `is_active = 1`
- [ ] Clear browser cache
- [ ] Refresh /scan page

### Issue: Validation always fails
- [ ] Check server timezone
- [ ] Verify server time matches actual time
- [ ] Check database connection
- [ ] Look at `writable/logs/` for error details

### Issue: Lateness not calculated
- [ ] Verify PHP DateTime functions work
- [ ] Check that `validateSessionTime()` is called
- [ ] Add debug log in PresensiPesertaModel.php if needed

### Issue: Session dropdown empty
- [ ] Verify at least 1 session created and active
- [ ] Check table `tb_sesi` has data
- [ ] Verify SQL: `SELECT * FROM tb_sesi WHERE is_active = 1`

---

## 📊 Success Criteria

**Mark as ✅ Complete when:**

1. ✅ PHP syntax verified (no errors)
2. ✅ Code deployed to production
3. ✅ Admin can create/edit sessions
4. ✅ Peserta can select session when scanning QR
5. ✅ Attendance before jam_mulai → Success (0 min late)
6. ✅ Attendance after jam_mulai, before jam_selesai → Success (with lateness)
7. ✅ Attendance after jam_selesai → Error message shown
8. ✅ Peserta can't absen twice same session → Error shown
9. ✅ WhatsApp notification includes lateness info
10. ✅ Admin trained and comfortable with feature

---

## 📞 Rollback Plan (if needed)

If critical issue found:

1. Revert code changes
   ```bash
   git checkout app/Models/PresensiPesertaModel.php
   git checkout app/Controllers/Scan.php
   ```

2. Verify database (no migration needed, schema already exists)

3. Clear cache and test

---

## 📚 Documentation Access

| For | File | Access |
|-----|------|--------|
| Admin Quick Start | `QUICK_REFERENCE_SESI.md` | `/QUICK_REFERENCE_SESI.md` |
| Admin Full Guide | `PANDUAN_SESI_ABSENSI.md` | `/PANDUAN_SESI_ABSENSI.md` |
| Developer Tech Docs | `DOCS_SESI_TEKNIS.md` | `/DOCS_SESI_TEKNIS.md` |
| Summary | `IMPLEMENTASI_SESI_SUMMARY.md` | `/IMPLEMENTASI_SESI_SUMMARY.md` |

---

## 🎯 Post-Launch Monitoring

### First Week
- [ ] Monitor `writable/logs/` for any errors
- [ ] Get user feedback on session dropdown UX
- [ ] Check if lateness calculation is accurate
- [ ] Monitor performance (query times)

### First Month
- [ ] Analyze attendance patterns
- [ ] Check if grace period needed (currently none)
- [ ] Gather requirements for future enhancements
- [ ] Document any customizations made

---

## 📝 Sign-off

| Role | Name | Date | Sign |
|------|------|------|------|
| Developer | - | - | _____ |
| Admin/Supervisor | - | - | _____ |
| Manager | - | - | _____ |

---

**Document Version:** 1.0
**Last Updated:** 2026-07-10
**Status:** Ready for Production Deployment

---

## 🚀 Final Steps Before Launch

1. **Backup everything**
   ```bash
   mysqldump -u root -p db_absensi > backup_2026-07-10.sql
   ```

2. **Deploy code**
   ```bash
   git pull origin main
   # or copy files manually
   ```

3. **Verify deployment**
   - Test creating new session
   - Test QR code scan with session selection
   - Monitor logs

4. **Announce to users**
   - Email/chat announcement
   - Training session (optional)
   - Help desk contact info

5. **Monitor for 24 hours**
   - Watch error logs
   - Answer user questions
   - Document issues

**You're ready! 🎉**

---

For questions or issues, refer to:
- Technical: `DOCS_SESI_TEKNIS.md`
- User: `PANDUAN_SESI_ABSENSI.md`
- Quick Help: `QUICK_REFERENCE_SESI.md`
