Mercurial > hg > webaudioevaluationtool
diff python/commentquestion_parser.py @ 2991:77114de617ba
Include comment question sample number, as pool randomisation mixes these up - temporary fix
author | Dave Moffat <me@davemoffat.com> |
---|---|
date | Mon, 16 Jul 2018 14:51:18 +0100 |
parents | 44a6a61de7fc |
children |
line wrap: on
line diff
--- a/python/commentquestion_parser.py Mon Jul 16 14:48:06 2018 +0100 +++ b/python/commentquestion_parser.py Mon Jul 16 14:51:18 2018 +0100 @@ -42,6 +42,7 @@ # get the list of pages for page in root.findall("./page"): pagename = page.get("ref") + trackname = page.find('audioelement').get('ref') if pagename is None: # ignore 'empty' audio_holders print("WARNING: " + filename + " contains empty audio holder. (commentquestion_parser.py)") break @@ -63,7 +64,7 @@ except KeyError: commentStore = []; questionStore[cqid] = commentStore - commentStore.append({"subject": subject_id, "value": response}) + commentStore.append({"subject": subject_id, "value": response, "trackName": trackname}) for page in pagestore.keys(): print page @@ -73,6 +74,6 @@ for comment in pagestore[page].keys(): with open(pagedir+"/"+comment+".csv", "w") as csvfile: filewriter = csv.writer(csvfile, delimiter=',') - filewriter.writerow(("save_id", "value")) + filewriter.writerow(("save_id", "value", "trackName")) for entry in pagestore[page][comment]: - filewriter.writerow((entry["subject"], entry["value"])) \ No newline at end of file + filewriter.writerow((entry["subject"], entry["value"], entry["trackName"])) \ No newline at end of file