Skip to content

Student report card: optional tikuf summary from the student-report site - #268

Open
buzz-code wants to merge 1 commit into
mainfrom
claude/report-card-tikuf-summary
Open

buzz-code wants to merge 1 commit into
mainfrom
claude/report-card-tikuf-summary

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

Part of buzz-code/ops#62

Lets the existing bulk student report card (studentReportCardReact) include, per student, the number of attendance-validation (tikuf) days kept in the student-report site. Future "combined" letters can reuse the same util.

How it works

  • New report option showTikuf (checkbox in the report dialog, shown only to users that have a key). When on, getReportData asks the student-report site for the summary and prints תיקופי נוכחות: N ימים under the table.
  • src/utils/tikuf-summary.util.ts calls GET <STUDENT_REPORT_API_URL>/integration/tikuf-summary with x-api-key. One request per report run (a 60s in-memory cache is shared by the parallel per-student calls). Students are matched by tz (trimmed, leading zeros dropped). Explicit start/end dates are sent as fromDate/toDate; otherwise the report year is sent.
  • Failure handling: if the option is on and the site address/key is missing, the key is rejected, or the site is unreachable/errors, report generation fails with a Hebrew message. It never produces letters silently without the requested data.

Configuration

  • Env STUDENT_REPORT_API_URL (base API address of the student-report server; added to .env.template, docker-compose.yml, docker-compose-swarm.yml). It is deliberately an env var and not a user setting: additionalData is user-writable through the settings endpoint, so a per-user URL would let any user make the server call arbitrary hosts.
  • Per user: additionalData.studentReportApiKey, the same value as additionalData.integrationApiKey of the matching user on the student-report site (see its endpoint PR).

Depends on the student-report endpoint (buzz-code/student-report-nra#97). No server/shared change in this PR.

Tests: util spec (normalization, query building, single shared request, tz matching, missing config, unreachable site with retry, 401/500) and a generateStudentReportCard assertion for the new param. Server typecheck is clean. Full server suite: only year.util.behavior and attendance-cleanup-sweep fail, both timezone-dependent and failing identically on a clean checkout (they pass with TZ=UTC). The PDF rendering of the new line and the client checkbox were not exercised in a browser.


Generated by Claude Code

The bulk student report card can now include, per student, the number of
attendance-validation days read from the student-report site
(GET /integration/tikuf-summary). Students are matched by tz.

- the site address comes from the STUDENT_REPORT_API_URL env var (never from
  user settings, so a user cannot make the server call arbitrary hosts)
- the key comes from user.additionalData.studentReportApiKey
- one request per report run, shared by all students through a 60s cache
- if the option is on and the site is not set up, rejects the key or is down,
  report generation fails with a clear message instead of producing letters
  without the data that was asked for
- the checkbox only shows for users that have a key

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012GTicqeyaQ8prWTxxfKSrP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants