25 lines
779 B
Python
25 lines
779 B
Python
import json
|
|
from scheduler import PhotoScheduler
|
|
|
|
def run_test():
|
|
# Indlæs JSON
|
|
with open('data.json', 'r', encoding='utf-8') as f:
|
|
data = json.load(f)
|
|
|
|
scheduler = PhotoScheduler(data)
|
|
plan = scheduler.solve()
|
|
|
|
if plan:
|
|
print("✅ Fotoplan fundet!")
|
|
print(f"{'Klasse':<10} | {'Start':<10} | {'Slut':<10} | {'Varighed (min)':<10}")
|
|
print("-" * 45)
|
|
# Sorter efter starttid
|
|
sorted_plan = sorted(plan.items(), key=lambda x: x[1]['start'])
|
|
for cid, times in sorted_plan:
|
|
print(f"{cid:<10} | {times['start']:<10} | {times['end']:<10} | {times['duration']:<10}")
|
|
else:
|
|
print("❌ Det var umuligt at lave en plan, der overholder alle krav.")
|
|
|
|
if __name__ == "__main__":
|
|
run_test()
|