-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexportIssues.py
executable file
·54 lines (41 loc) · 1.18 KB
/
exportIssues.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Author: Corneel den Hartogh
Course: Heuristics
Description: Count and print the number of occurences per issue in selected rosters
"""
import random
import copy
import json
import time
import glob
import operator
from decimal import Decimal
from csvFilesController import classrooms,subjects,students
from classes import Classroom,Subject,Activity,Student,Roster
import classesImport as ci
from scoreFunction import getScore
from studentOptimization import studentOptimization
from roomOptimization import roomOptimization
startTime = time.process_time()
issues = []
num = 0
# iterate over the issues in selected rosters
for filename in glob.glob('imported_rosters/*.json'):
num += 1
with open(filename) as jsonfile:
data = json.load(jsonfile)
for x in (data["roster"]["issues"]):
issues.append(x["reference"])
issueDict ={}
issuesUnique = set(issues)
for issueUnique in issuesUnique:
i = 0
for issue in issues:
if issueUnique == issue:
i += 1
issueDict[issueUnique] = i
sorted_issues = sorted(issueDict.items(), key=operator.itemgetter(1), reverse=True)
for sorted_issue in sorted_issues:
print(sorted_issue)
print("issues: ", len(sorted_issues))
print("rosters: ", num)