No description
  • Python 49.1%
  • HTML 48.9%
  • JavaScript 1.5%
  • CSS 0.2%
  • Shell 0.2%
  • Other 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
xfx1337 4f26dd82b3 catalog: only subjects that still have classes, and preselect all their teachers
Two things made the subject list wrong and slow.

The catalog was built from every event ever parsed, so it listed last semester
alongside this one: 903 entries of which only 259 had a class from today onwards.
Students were scrolling past hundreds of subjects that no longer exist, and the
browser built a DOM node for each. Build it from classes on or after --since
(today by default); pass an older date to get the archive back.

Picking a subject then showed a fraction of its classes. The "select everything
the first time" check sat inside the per-teacher loop, so it fired once and only
the alphabetically first teacher stayed checked -- 2 of 33 classes for a subject
with 12 teachers. Decide once, before the loop, which is what the cards view
already did. An empty set still means the student deselected everyone, so their
choice is left alone.

/api/courses drops from 214KB to 55KB.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 16:28:46 +03:00
.github/workflows refactor structure (#1) 2026-04-20 23:33:49 +03:00
app catalog: only subjects that still have classes, and preselect all their teachers 2026-09-11 16:28:46 +03:00
tests refactor structure (#1) 2026-04-20 23:33:49 +03:00
tools chore: delete 2026-05-04 01:58:13 +03:00
.dockerignore refactor structure (#1) 2026-04-20 23:33:49 +03:00
.gitignore rebuild_catalog: keep service mailboxes out of the teacher directory 2026-09-07 13:03:43 +03:00
cookie.example.txt stop tracking cookie.txt 2026-09-07 12:48:39 +03:00
docker-compose-prod.yml docker compose fix 2026-05-03 00:38:53 +03:00
docker-compose.yml docker compose fix 2026-05-03 00:38:53 +03:00
Dockerfile refactor structure (#1) 2026-04-20 23:33:49 +03:00
example.env example env fix 2026-04-21 17:14:58 +03:00
logs.sh sync from prod: emergency bot worker, uv.lock, script exec bits 2026-09-07 12:10:13 +03:00
new_courses.csv initial 2026-04-19 21:44:34 +03:00
pyproject.toml auth fix 2026-04-23 10:50:03 +03:00
README.md stop tracking cookie.txt 2026-09-07 12:48:39 +03:00
rerun.sh sync from prod: emergency bot worker, uv.lock, script exec bits 2026-09-07 12:10:13 +03:00
sync_teachers_from_events.py teachers parse fix, thx novaello 2026-04-20 21:08:29 +03:00
uv.lock sync from prod: emergency bot worker, uv.lock, script exec bits 2026-09-07 12:10:13 +03:00

cu 3rd view

Backend and frontend for collecting and serving university schedule data, matching recordings, and running a KTalk attendance worker.

Structure

app/
  api/routes/        FastAPI route modules by domain
  core/              config and logging
  integrations/      Yandex and KTalk clients
  services/          shared helpers
  scripts/           operational utilities
  workers/           background worker entrypoints
  templates/         HTML pages
tests/               pytest suite
pyproject.toml       uv project metadata
uv.lock              locked dependency graph
docker-compose.yml   local development stack
Dockerfile           container image

Configuration

Copy example.env to .env and fill in the real values.

Required runtime files:

  1. .env (copy from example.env)
  2. cookie.txt (copy from cookie.example.txt, then paste the Yandex Calendar cookie header)
  3. ktalk_auth.txt

All three hold live credentials and are gitignored -- never commit them.

The app reads configuration only from environment variables and file paths declared in .env.

Local Development

Install dependencies:

uv sync --dev

Run the API:

uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8082

Run the worker:

uv run cu-3rd-view-worker

Run tests:

uv run pytest

Docker Compose

Start local development stack:

cp example.env .env
docker compose up --build

Services:

  • web: FastAPI app with live reload
  • worker: background KTalk/Yandex worker
  • db: PostgreSQL 16

Utility Scripts

Populate database from CSV:

uv run cu-3rd-view-parse

Insert a manual test event:

uv run cu-3rd-view-add-test-event

CI

GitHub Actions runs pytest on every push and pull request via .github/workflows/tests.yml.