forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/domain/profile.rsClear filter

2026-09-23

✨ feat(profile): add gender, address, and emergency contact to the user row Local-Gate: 1f2b0abcf3798a63b2c5365e0d15c9f708f45833 (1523 passed, 430s)Ahmet Kaan Gümüş · f151345
✨ feat(profile): add gender, address, and emergency contact to the user row
Local-Gate: 1f2b0abcf3798a63b2c5365e0d15c9f708f45833 (1523 passed, 430s)

2026-09-12

2026-09-11

🧹 chore: split profile, badge, builder into domain/db/service layersAhmet Kaan Gümüş · 7f616c0
🧹 chore: split profile, badge, builder into domain/db/service layers

C3 identity lane. Moves, not rewrites:

- badge: BadgeStats::load / BadgeAward::list_for / sync (UPSERT with the
  earned_at = NONE idempotency stays whole) -> db::badge, with the
  award-key mint and the persistence tests; BadgeStat/BadgeStats/earned/
  BadgeAward (pure rules) stay in domain::badge; service::badge wraps
  list_for/sync for the web layer.
- profile: ProfileStats::load (+ PomodoroTotals, persistence tests) ->
  db::profile; newtypes + getters stay; service::profile::load wraps.
- builder: find_by_username/read/create(create_session)/find_by_token/
  delete_by_token -> db::builder; the idempotent seed ensure ->
  service::builder (ensure_admin precedent); both tests ride their fns.
- preferences, key: fully pure (validated newtypes, composite-id
  helpers) — stay domain-only, no db/service modules created.

Entity fields the split constructs from are now pub(crate) (Builder,
BuilderSession, ProfileStats), matching the user split.

Callers re-pointed crate-wide: web/{users,exams/mod,questions,homework,
sessions,auth,extractor,builder,tenant_state}, service/exam_attempt.rs
(badge::sync after start), database.rs (control seed), tests/
{builder_api,e2e,integration}; cross-lane compile fixups in
domain/pomodoro.rs and domain/session_attendance.rs (their lanes
re-point on merge). constant.rs doc link -> crate::db::badge::list_for.

2026-08-04

feat: 🎖️ earn badges on both sides of the classroomAhmet Kaan Gümüş · 46c76f5
feat: 🎖️ earn badges on both sides of the classroom

Pass 2 gave badges only to students doing their own homework. Seven new
families cover the rest of the school and the two shapes a plain tally
could not express.

Teachers earn `marks_given` (a grade recorded, once per pair — a regrade
moves nothing), `lessons_held` (credited at the first roll call taken for
a session, so a lesson scheduled and cancelled counts for nothing), and
`pool_approved`. Students earn `pool_published`, `high_mark` (an exam
mark at or above 90, once per sitting), `lessons_attended` (marked
present or late at roll call, moved back down by a correction), and
`study_streak` — the longest run of consecutive days finishing a
pomodoro, read as a high-water mark so breaking it never takes the badge
back. Days end at midnight UTC, like every other day calculation here.

Both counters of the question pool skip a self-approval: a counter moves
only when one person's work was judged by somebody else, which closes the
ask-approve-delete farm on the staff side the way crediting at approval
closes it on the student side.

Every counter moves inside the transaction of the write that causes it.
The streak needs two statements rather than one because sibling SET
clauses read the row's before-state, so `longest` would lag `current`
forever; the pair sits in one transaction, and `max` keeps it monotone
under every interleaving, verified on a real 3.2.3 server. No backfill
and no migration mark: every counter starts at zero at this deploy.
feat: 🏅 earn badges for the work already doneAhmet Kaan Gümüş · a00880e
feat: 🏅 earn badges for the work already done

Thirteen badges a student earns by doing the work, so the profile has
something to be proud of rather than just a photo and a bio.

Nothing awards a badge by hand and nothing takes one away. A badge is
earned when a counter crosses a threshold, and it is permanent: withdraw
the submission that earned it and the count falls while the badge stays,
because a stamped `earned_at` is the motivational payload and a badge
that evaporates is worse than no badge. The catalog is hardcoded, so
changing a threshold is a deploy and the evaluator stays a pure function
of the counters. It rides GET /limits as a group like every other bound;
labels and icons are the frontend's, keyed by badge id.

The counters are the real work. Homework, exam and attempt tables are
indexed for the questions the rest of the API asks, so counting a single
student's history meant a full table scan — the numbers are therefore
tallied at write time, in the same transaction as the write that causes
them. Existing accounts are seeded once from their real history, gated by
a mark whose skip is proven rather than assumed, so nobody starts at zero
for work they already did.

Withdrawing your own submission decrements, and that is the only
decrement in the codebase: withdrawal is student-callable, so without it
submit/delete/submit would farm the counter. Cascades never decrement —
history a teacher erased is still history the student lived. The cost is
that a re-run seed, which can only count rows that still exist, comes out
lower than the live tally; documented where someone would otherwise
"repair" it.

Deadlines move, so the on-time verdict is now stored on the submission
beside the count it fed. Judging it again at withdrawal read whatever the
deadline had become since, which drifted the tally in both directions —
far enough that on-time could exceed submitted.

Attendance counters were dropped: those tables already carry per-user
indexes, so there is no scan to fix, the status list is school-editable,
and roll-call corrections would need a decrement that fights permanence.
feat: 🪪 give every person a public profileAhmet Kaan Gümüş · b326165
feat: 🪪 give every person a public profile

Avatar, bio, display name, live class/course blocks and read-time stat
counters, so the school has something to motivate students with.

The fields ride the user row rather than a profile table: the row already
carries the self-service columns and their field-scoped writers, so a
separate table would only add a "profile row missing" state every read
must degrade, plus a second write to the admin-seed path. DDL only, no
backfill — every pre-existing row reads null, or 0 for derived stats.

Contact fields stay off the public projection and keep their old gate.
Reads are school-wide except for parents, who reach only their own
profile and their currently-linked students'; the link and the target's
live role are re-read per call, so a promoted-out student stops being
readable at once. The courses block is intersected with what the viewer
can already see, since a course title a caller is 403'd from reading
directly must not leak through someone else's profile. stats.courses
stays the owner's true total — an aggregate reveals magnitude, not
identity — so a stranger sees an empty block beside a non-zero count.
Classes stay a narrowed id/name/grade projection: a homeroom section is
the social signal, a private club name is not.

Stats are computed at read and floored at 0. Exam average, homework rate
and attendance rate are deliberately absent: those tables are indexed
such that a per-user aggregate is a full table scan.

Avatars reuse the one-image-on-the-owning-row pattern and the school's
existing max_file_bytes, raster only. Deleting one is admin-reachable
because an offensive avatar is a real school problem and no user-delete
route exists to fall back on.

Also floors pomodoro focus time at both ends: a backwards clock could
record a negative stint, which the profile would have served as a
negative total.

No badges yet — those are auto-earned only and land next.

2026-07-12

🐛 fix(time): single UTC clock source, lint-banned alternativesAhmet Kaan Gümüş · 221606f
🐛 fix(time): single UTC clock source, lint-banned alternatives

Timestamp::now() is the sole wall-clock read; today_utc() and
in_days() derive from it. clippy disallowed-methods/-types at deny
ban chrono::Local/Utc::now, SystemTime::now, OffsetDateTime::now_*,
NaiveDateTime, and absolute cookie Expires, so local-time or
client-clock comparisons cannot be reintroduced.

Birth dates accept up to UTC-tomorrow: a client ahead of UTC (up
to UTC+14) legitimately submits a calendar date the server's UTC
day has not reached; the old check rejected it as future.

2026-07-11

✨ feat(profile): optional personal info on user accountsAhmet Kaan Gümüş · baceaf5
✨ feat(profile): optional personal info on user accounts

Every account (any role) gains name, surname, email, phone, and birth
date as optional fields backed by validated newtypes: PersonName keeps
unicode and trims, Email and Phone get pragmatic shape validators, and
BirthDate parses real calendar dates in YYYY-MM-DD form and refuses the
future. Existing rows read back as None via option<string> columns.

Endpoints: PATCH /users/me lets any authenticated user edit their own
info; GET /users/{id} and PATCH /users/{id}/profile give admins the
school-office path for maintaining records. Patch semantics per field:
omitted keeps the current value, an empty string clears it, anything
else is validated and set. UserResponse now carries the new fields.