Start work on attendance sheet.
This commit is contained in:
parent
a86063e722
commit
eff186cb4c
3 changed files with 115 additions and 3 deletions
11
src/Makefile
11
src/Makefile
|
@ -42,7 +42,8 @@ HACKERBASE-DEPS=hackerbase.scm cal-month.import.scm \
|
|||
tests.import.scm notifications.import.scm logging.import.scm \
|
||||
progress.import.scm cal-period.import.scm \
|
||||
util-stdout.import.scm export-web-static.import.scm \
|
||||
dokuwiki.import.scm mailinglist.import.scm
|
||||
dokuwiki.import.scm mailinglist.import.scm \
|
||||
export-sheet.import.scm
|
||||
|
||||
HACKERBASE-OBJS=hackerbase.o testing.o listing.o cal-month.o \
|
||||
cal-period.o ansi.o util-bst-ldict.o command-line.o mbase.o \
|
||||
|
@ -60,7 +61,7 @@ HACKERBASE-OBJS=hackerbase.o testing.o listing.o cal-month.o \
|
|||
util-dir.o dokuwiki.o racket-kwargs.o duck.o util-bst.o \
|
||||
util-bst-bdict.o util-bst-ldict.o util-bst-lset.o mailman2.o \
|
||||
mailman-common.o mailman3.o mailman3-sql.o tiocgwinsz.o \
|
||||
mailinglist.o
|
||||
mailinglist.o export-sheet.o
|
||||
|
||||
GENDOC-SOURCES=gendoc.scm duck-extract.import.scm \
|
||||
util-time.import.scm util-csv.import.scm util-git.import.scm \
|
||||
|
@ -559,3 +560,9 @@ MAILINGLIST-SOURCES=mailinglist.scm racket-kwargs.import.scm \
|
|||
|
||||
mailinglist.o: mailinglist.import.scm
|
||||
mailinglist.import.scm: $(MAILINGLIST-SOURCES)
|
||||
|
||||
EXPORT-SHEET-SOURCES=export-sheet.scm mbase.import.scm \
|
||||
brmember.import.scm
|
||||
|
||||
export-sheet.o: export-sheet.import.scm
|
||||
export-sheet.import.scm: $(EXPORT-SHEET-SOURCES)
|
||||
|
|
97
src/export-sheet.scm
Normal file
97
src/export-sheet.scm
Normal file
|
@ -0,0 +1,97 @@
|
|||
;;
|
||||
;; export-sheet.scm
|
||||
;;
|
||||
;; Export attendance sheet as MarkDown document.
|
||||
;;
|
||||
;; ISC License
|
||||
;;
|
||||
;; Copyright 2024 Brmlab, z.s.
|
||||
;; Dominik Pantůček <dominik.pantucek@trustica.cz>
|
||||
;;
|
||||
;; Permission to use, copy, modify, and/or distribute this software
|
||||
;; for any purpose with or without fee is hereby granted, provided
|
||||
;; that the above copyright notice and this permission notice appear
|
||||
;; in all copies.
|
||||
;;
|
||||
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
||||
;; CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
;; OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
;; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
;; CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
;;
|
||||
|
||||
(declare (unit export-sheet))
|
||||
|
||||
(module
|
||||
export-sheet
|
||||
(
|
||||
print-attendance-sheet
|
||||
)
|
||||
|
||||
(import scheme
|
||||
(chicken base)
|
||||
(chicken string)
|
||||
(chicken format)
|
||||
mbase
|
||||
brmember
|
||||
brmember-format
|
||||
util-bst-ldict)
|
||||
|
||||
(define (print-attendance-sheet MB)
|
||||
(print "\\documentclass[11pt]{article}")
|
||||
(print "\\usepackage[top=1cm,left=2cm,right=2cm,bottom=2cm]{geometry}")
|
||||
(print "\\begin{document}")
|
||||
(print "\\begin{center}")
|
||||
(print
|
||||
(format
|
||||
"Prezenční listina ~A. Valné Hromady brmlab z.s. konané ~A v sídle spolku"
|
||||
666
|
||||
"1.2.3456"))
|
||||
(newline)
|
||||
(print "\\vskip1em")
|
||||
(newline)
|
||||
(define colnames
|
||||
'((id) Nick Name Surname (Balance) (Active) Signature))
|
||||
(print
|
||||
(format
|
||||
"\\begin{tabular}{|~A|}"
|
||||
(string-intersperse
|
||||
(map
|
||||
(lambda (x)
|
||||
"l")
|
||||
colnames)
|
||||
"|")))
|
||||
(print
|
||||
(string-intersperse
|
||||
(map
|
||||
(lambda (x)
|
||||
(format
|
||||
"\\textbf{~A}"
|
||||
(if (symbol? x)
|
||||
(symbol->string x)
|
||||
(symbol->string (car x)))))
|
||||
colnames)
|
||||
"&")
|
||||
"\\\\")
|
||||
(print "\\hline")
|
||||
(let loop ((mrs (find-members-by-predicate
|
||||
MB (lambda (mr)
|
||||
(brmember-active? mr)))))
|
||||
(when (not (null? mrs))
|
||||
(let* ((mr (car mrs))
|
||||
(info (ldict-ref mr 'info))
|
||||
(name (ldict-ref info 'name "ERROR")))
|
||||
(print
|
||||
(brmember-id mr)
|
||||
" & "
|
||||
"name"
|
||||
" \\\\")
|
||||
(loop (cdr mrs)))))
|
||||
(print "\\end{tabular}")
|
||||
(print "\\end{center}")
|
||||
(print "\\end{document}"))
|
||||
|
||||
)
|
|
@ -51,7 +51,8 @@
|
|||
dokuwiki
|
||||
racket-kwargs
|
||||
util-string
|
||||
mailinglist)
|
||||
mailinglist
|
||||
export-sheet)
|
||||
|
||||
;; Command-line options and configurable parameters
|
||||
(define -needs-bank- (make-parameter #f))
|
||||
|
@ -182,6 +183,10 @@
|
|||
(-stats (file:gnuplot-data) "Get stats for all months"
|
||||
(-action- 'print-stats)
|
||||
(-fname- file:gnuplot-data))
|
||||
(-sheet (filename) "Generate attendance sheet"
|
||||
(-needs-bank- #t)
|
||||
(-action- 'gen-sheet))
|
||||
|
||||
""
|
||||
"Mailman Actions:"
|
||||
(-mlsync () "Synchronize internal ML"
|
||||
|
@ -354,6 +359,9 @@
|
|||
((genweb)
|
||||
(log-info "Generating static web files")
|
||||
(gen-html-members MB (-web-dir-)))
|
||||
((gen-sheet)
|
||||
(log-info "Generating attendance sheet")
|
||||
(print-attendance-sheet MB))
|
||||
((edit)
|
||||
(if mr
|
||||
(let ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue