Commit 6dc0ca1c authored by Joanne Hugé's avatar Joanne Hugé

Add generate_tables function in measure set handler

parent f13dc492
......@@ -54,15 +54,41 @@ class MeasureSetHandler:
if mtype in self.measure_sets and len(self.measure_sets[mtype]['ids']) > 0:
self.measure_sets[mtype]['ids'].remove(mid)
measure_file_name = MeasureSetHandler.measures_dir + "/" + mtype + str(mid)
measure_file_name = "{}/{}{}".format(MeasureSetHandler.measures_dir, mtype, mid)
os.remove(measure_file_name)
self.save()
print("Removed measure {}{}".format(mtype, mid))
def remove_all(self):
for mtype in self.measure_sets:
for mid in self.measure_sets[mtype]['ids']:
print(" Deleting {}{}...".format(mtype, mid))
self.remove_measure_set(mtype, mid)
print("Removed all measures".format(mtype, mid))
def generate_tables():
with open(self.measures_dir + "/" + "measure_tables.md") as measure_table:
measure_table.write("# Measure Tables\n\n")
for mtype in self.measure_sets:
need_header = True
measure_table.write("## {} Tables\n\n".format(mtype))
for mid in self.measure_sets[mtype]['ids']:
measure = self.get_measure_set("{}{}".format(mtype, mid))
if need_header:
measure_table.write(measure.generate_table(headers=True))
need_header = False
else:
measure_table.write(measure.generate_table(headers=False))
measure_table.write("\n")
class MeasureSet:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment