Documentation
¶
Overview ¶
Package pdfgen renders the planning PDFs (maroto documents) from already-fetched data. The plexams package gathers the data from the DB and passes it in; the pure table-content builders here (…Rows) are I/O-free and unit-tested, and the render functions wrap them with the shared page furniture. Keeping the maroto layout out of the plexams god-package is the point.
Index ¶
- func Constraints(semesterFull, jiraURL string, exams []*model.ZPAExamWithConstraints, ...) pdf.Maroto
- func ConstraintsRows(exams []*model.ZPAExamWithConstraints, sameSlotExam map[int]*model.ZPAExam) [][]string
- func DraftDoc(landscape bool, title, planerName, planerEmail, note string) pdf.Maroto
- func ExahmHeading(sortByDate bool) string
- func ExahmRows(exams []*model.PlannedExam, sortByDate bool, ...) [][]string
- func ExahmTable(m pdf.Maroto, sortByDate bool, rows [][]string)
- func ExamRows(exams []*model.PlannedExam, slotTime func(day, slot int) time.Time) [][]string
- func ExamTable(m pdf.Maroto, name string, rows [][]string)
- func ExamsToPlan(semesterFull, jiraURL string, exams []*model.ZPAExam) pdf.Maroto
- func ExamsToPlanRows(exams []*model.ZPAExam) [][]string
- func FormatTermin(t time.Time) string
- func ProgramRows(exams []*model.PlannedExam, program string, ...) [][]string
- func ProgramTable(m pdf.Maroto, programLong string, rows [][]string)
- func SameModulNames(semesterFull string, exams []*model.ZPAExam) pdf.Maroto
- func SameModulNamesRows(exams []*model.ZPAExam) [][]string
- func SameSlotAncodes(exams []*model.ZPAExamWithConstraints) []int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Constraints ¶
func Constraints(semesterFull, jiraURL string, exams []*model.ZPAExamWithConstraints, sameSlotExam map[int]*model.ZPAExam) pdf.Maroto
Constraints renders the landscape constraints PDF. sameSlotExam resolves the same-slot partner ancodes (pre-fetched by the caller; see SameSlotAncodes).
func ConstraintsRows ¶
func ConstraintsRows(exams []*model.ZPAExamWithConstraints, sameSlotExam map[int]*model.ZPAExam) [][]string
ConstraintsRows builds the constraints table rows (AnCode, Prüfender, Modul, Gruppe(n), Constraints), grouped and sorted by examer name; exams marked NotPlannedByMe are dropped. sameSlotExam resolves a same-slot partner ancode to its exam for the "zeitgleich: …" line (nil is tolerated only as far as the original code).
func DraftDoc ¶
DraftDoc builds the shared "vorläufiger Planungsstand" draft document shell: the footer, a bold title, the planner line and a centered note (e.g. "--- zur Abstimmung ---" or "--- ENTWURF ---"). landscape selects the page orientation (the EXaHM draft is landscape, the rest portrait).
func ExahmHeading ¶
ExahmHeading returns the EXaHM/SEB table heading, which names the sort order.
func ExahmRows ¶
func ExahmRows(exams []*model.PlannedExam, sortByDate bool, slotTime func(day, slot int) time.Time, prePlannedRooms map[int][]string) [][]string
ExahmRows builds the EXaHM/SEB draft table rows (AnCode, Modul, Prüfender, Termin, Form, Plätze, Räume). When sortByDate the exams are ordered by (day, slot, ancode), otherwise the input order is kept. slotTime resolves a plan entry to its start; prePlannedRooms maps an ancode to its pre-planned room names, used only when the exam has no planned rooms yet. Every exam must already carry non-nil Constraints.RoomConstraints (the caller filters to EXaHM/SEB exams).
func ExahmTable ¶
ExahmTable renders the EXaHM/SEB heading and table into m.
func ExamRows ¶
ExamRows builds the simple (AnCode, Modul, Prüfender, Termin) draft table rows sorted by ancode. An exam without a plan entry shows "fehlt noch"; slotTime resolves a plan entry's (day, slot) to its start. Used by the special-interest / LBA-repeater drafts.
func ExamsToPlan ¶
ExamsToPlan renders the portrait "exams to plan" PDF (centrally planned exams, grouped by examer).
func ExamsToPlanRows ¶
ExamsToPlanRows builds the "exams to plan" table rows (AnCode, Modul, Prüfender, Gruppe(n)), grouped and sorted by examer name.
func FormatTermin ¶
FormatTermin renders a slot start time as e.g. "Mo. 02.01.06, 15:04 Uhr".
func ProgramRows ¶
func ProgramRows(exams []*model.PlannedExam, program string, slotTime func(day, slot int) time.Time) [][]string
ProgramRows builds the per-program draft table rows (AnCode, Modul, Prüfender, Termin) sorted by ancode. For an exam with a Primuss section in this program the section's ancode is used; a section with no registrations stops the listing (matching the original behaviour). slotTime resolves a plan entry's (day, slot) to its start.
func ProgramTable ¶
ProgramTable renders one program's heading and its exam table into m.
func SameModulNames ¶
SameModulNames renders the landscape "modules with the same name" PDF.
func SameModulNamesRows ¶
SameModulNamesRows builds the "modules with the same name" table rows (Modul, AnCode, Prüfender, Gruppe(n), Form): one block per module name (sorted), the module name shown only on the first row, followed by a blank separator row.
func SameSlotAncodes ¶
func SameSlotAncodes(exams []*model.ZPAExamWithConstraints) []int
SameSlotAncodes returns the distinct same-slot partner ancodes referenced by the constraints, so the caller can pre-resolve their exams before rendering.
Types ¶
This section is empty.