Spaces:
Runtime error
Runtime error
Commit History
-
refactor(ta-01): swap supabase-py for boto3 S3 adapter
Greg +1: Claude Opus 4.7 (1M context)The supabase-py SDK was ~70MB with sub-deps and only used for storage. Switch to boto3 against Supabase's S3-compatible endpoint. Same class name (SupabaseStorage) for adapter-pattern continuity; the constructor now takes access_key/secret_key/endpoint/region and uses presigned URLs via generate_presigned_url for private buckets. Env vars (HF Space Secrets): SUPABASE_ACCESS_KEY_ID (from Dashboard → Project Settings → Storage → S3) SUPABASE_ACCESS_KEY_SECRET SUPABASE_ENDPOINT (e.g. https://<ref>.storage.supabase.co/storage/v1/s3) SUPABASE_REGION (default us-west-2) SUPABASE_PHOTO_BUCKET (default user-photos) Side benefit: vendor-agnostic. The same adapter works against AWS S3, R2, MinIO by changing endpoint and region. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>959bccd -
feat(ta-01): implement SupabaseStorage adapter with signed URLs
Greg +1: Claude Opus 4.7 (1M context)- SupabaseStorage uploads to {account_id}/{user_id}/{uuid}.{ext} inside the configured bucket via supabase-py. get_url() returns a short-lived signed URL (default 10 min TTL) so private buckets stay private. - _strip_url_prefix normalizes inputs so delete() works whether given a relative path or a full Supabase URL (with or without query token). - supabase>=2.0 added to requirements; SDK is lazily imported so the local backend (PHOTO_STORAGE_BACKEND=local) doesn't pay the cost. - AuthImage now passes http(s):// URLs through directly (Supabase signed URLs are already authenticated via the token query param). - Tests updated to cover credential check, prefix stripping for relative paths and signed URLs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>ea91fea
-
fix(ta-01): unify all dashboard chart counts as gate+class (deduped)
Greg +1: Claude Opus 4.7 (1M context)Extract three helpers in dashboard.py: _presence_user_ids_in_range — union of EntranceLog + Attendance "in" _exit_user_ids_in_range — union of EntranceLog.checkout + Attendance "out" _presence_user_ids_by_day — per-day version of presence union Refactor: /stats today_checkins = |present_today| /stats today_checkouts = |exited_today| /stats currently_on_campus = |present_today - exited_today| /attendance-trend per-day count = |union per day| These apply uniformly to admin and teacher roles. A student with both a gate check-in and a classroom mark on the same day counts ONCE per metric; a student marked only via classroom (TA-01 contingency) is now included. Regression tests cover: class-only inclusion, gate+class dedup, currently_on_campus subtraction across both event sources, and per-day trend dedup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1abf246 -
fix(ta-01): dashboard sex-by-section counts class marks without gate log
Greg +1: Claude Opus 4.7 (1M context)The /dashboard/sex-by-section endpoint joined only EntranceLog, so students marked present via teacher/admin classroom attendance with no gate check-in (contingency path enabled by TA-01) were excluded from the chart. Now unions EntranceLog (gate) with Attendance.action='in' (classroom) and dedupes per (section, student). Regression test covers a student present in Attendance with zero EntranceLog rows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>a62864b -
feat(ta-01): admin attendance endpoints (sections, roster, swipe, batch-toggle)
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>138c1eb -
test(ta-01): regression test for gate ↔ classroom decouple
Greg +1: Claude Sonnet 4.6Adds three tests that expose (and then verify removal of) the coupling between EntranceLog gate check-in and classroom attendance marking in submit_swipe, batch_toggle, and toggle_attendance. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>5bea392 -
feat(ta-01): add attendance service (record_attendance + list_section_roster)
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>238a12d -
feat(ta-01): POST /users/{id}/photo endpoint with storage + best-effort face encoding
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>d116d3f -
feat(ta-01): add photo_pipeline with WebP compression and validation
Greg +1: Claude Opus 4.7 (1M context)Adds image processing service with: - MIME type validation (PNG, JPEG, WebP only) - EXIF transpose handling - Thumbnail scaling to max 800x800 - WebP conversion with quality 85 - Test suite with 5 comprehensive test cases Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>34ae3e8 -
feat(ta-01): add PhotoStorage abstraction with Local/InMemory/Supabase adapters
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>9e5f651
-
fix(dashboard): 400 on malformed section_ids; harden test cleanup
Greg +1: Claude Opus 4.7 (1M context)Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>fad8e8a -
feat(dashboard): add GET /sex-by-section endpoint
Greg +1: Claude Opus 4.7 (1M context)Returns per-section and aggregate sex counts of students with entrance logs in the requested date range; supports section_ids filter and teacher-scoped access. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>0eebffb -
feat(teacher): include present_today in swipe and batch-toggle responses
Greg +1: Claude Opus 4.7 (1M context)Both submit_swipe and batch_toggle now return a present_today field with sex-aggregated counts (masculino, femenino, sin_especificar, total) of students marked present in the section for the relevant day. Cleanup helper updated to also delete EntranceLog rows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>43b8be0 -
feat(teacher): add GET /sections/{id}/present-summary for M/F chip
Greg +1: Claude Opus 4.7 (1M context)Returns masculino/femenino/sin_especificar/total counts of students with an 'in' Attendance record today (or a given ?date=). RBAC-gated to teacher role; owner-check via _ensure_teacher_section. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>100eb7b -
feat(attendances): report-export CSV ends with M/F totals block
Greg +1: Claude Opus 4.7 (1M context)Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>4d635e1 -
feat(attendances): today-export CSV ends with M/F totals block
Greg +1: Claude Opus 4.7 (1M context)Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>6720653 -
feat(reports): late-arrivals CSV ends with M/F totals block
Greg +1: Claude Opus 4.7 (1M context)Append a blank-separated totals block to the late-arrivals-export CSV using count_by_sex so consumers get Masculino / Femenino / (Sin especificar) / Total general without a second request. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>81106b5 -
refactor(sex): cleaner import, drop sex= on system users, harden empty input
Greg +1: Claude Opus 4.7 (1M context)Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>5b2025a -
feat(seed): assign sex to all seeded users via sex_for helper
Greg +1: Claude Opus 4.7 (1M context)Extends sex_counts.py with KNOWN_FEMALE/KNOWN_MALE dictionaries and a sex_for(first_name, rng) function; patches seed_demo.py to pass sex=sex_for(...) on every User constructor (teachers, administrativos, obreros, representatives, students, admin, dev). Adds 3 new tests (7 total, all passing). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>0f56cb1 -
test(utils): cover empty-string sex and harden cross-account teardown
Greg +1: Claude Opus 4.7 (1M context)Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>c5d1f72 -
feat(utils): add count_by_sex helper for M/F/null aggregations
Greg +1: Claude Opus 4.7 (1M context)Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>5fc7b3b
-
feat(db): add detect_db_state helper for entrypoint orchestration
Greg +1: Claude Opus 4.7 (1M context)Función pura que clasifica el estado de la BD (UPGRADE/STAMP/INIT) inspeccionando el schema 'public' para alembic_version + presencia de otras tablas. Habilita el reemplazo del flag manual RUN_MIGRATIONS en entrypoint.sh por detección automática. Cobertura: 4 tests unit contra Postgres local con schema aislado. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>54aa65c -
fix(seed): scope demo seeder to is_demo accounts; never touch customers
Greg +1: Claude Sonnet 4.6- Adds Account.is_demo column (migration 022, backfilled for existing demo) - seed_demo.py only operates on accounts where is_demo=True - Existing demo accounts are fully idempotent (no field overwrites) - Removes _clear_demo helper (used MySQL-specific syntax, was dead code) - Integration test guards against future regressions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>96577c8 -
test(integration): guard against accidental MariaDB/MySQL regressions
Greg8d61b6c -
feat(config): switch DATABASE_URL to PostgreSQL with env override support
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0461579