Weekend 22, some QoL improvements (added wiki_to_prefs_table.py, print wiki header in output as well)

This commit is contained in:
2026-02-01 15:16:59 +01:00
parent d329748b89
commit 467bdbd56f
4 changed files with 97 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#!nix-shell -i python3 -p python3 python3Packages.pyyaml glpk -I nixpkgs=flake:nixpkgs
#!nix-shell -i python3 -p python3 python3Packages.pyyaml glpk -I nixpkgs=flake:nixpkgs --extra-experimental-features flakes
import sys
import yaml
import re
@@ -143,6 +143,9 @@ def write_data(people, tasks, file=sys.stdout):
print(glpm.param("WL", config['weights']['likes']), file=file)
print(glpm.param("WH", config['weights']['hates']), file=file)
def write_tasks(people, tasks, file=sys.stdout):
days_tpl = " dag !!" * config['days']
print("! {} !!{} {} !! {}".format("wie", days_tpl, "vrolijkheid", "workload"), file=file)
print("|-", file=file)
for name, p in people.items():
days = [[] for i in range(config['days'])]
for (d,t) in p.does:
@@ -151,7 +154,7 @@ def write_tasks(people, tasks, file=sys.stdout):
days_fmt = " {} ||" * len(days)
days_filled = days_fmt.format(*map(q, days))
print("| {} ||{} {} || {}".format(name, days_filled, p.vrolijkheid(), p.workload(tasks)), file=file)
print("|-")
print("|-", file=file)
people = read_people(conf['people'])
with open('prefs_table', 'r') as pref_file:
read_prefs(pref_file, tasks, people)