def printResults(string, answers={}): history = DBtransactions.parseInput(string) if not isinstance(history, basestring): historyString = views.historyToString(history) historyTable = views.historyToTable(history) result = DBtransactions.computeEverything(history) conflictOperations = views.conflictOperationsToString(result['conflictOperations']) readingTAs = views.readingTAsToString(result['readingTAs']) committedTransactions = views.transactionListToString(result['committedTAs']) abortedTransactions = views.transactionListToString(result['abortedTAs']) graph = result['graph'] isSR = result['SR'] operationsNotRC = result['operationsNotRC'] isRC = result['RC'] operationsNotACA = result['operationsNotACA'] isACA = result['ACA'] operationsNotST = result['operationsNotST'] isST = result['ST'] resultString = historyTable+views.wrapInPanel("Konfliktoperationen", conflictOperations,3)+views.wrapInPanel("Lesende Transaktionen", readingTAs, 3)+views.wrapInPanel("Committete Transaktionen", committedTransactions, 3)+views.wrapInPanel("Abortete Transaktionen", abortedTransactions, 3)+views.htmlGraph()+"<div>"+views.wrapInPanel("Eigenschaften von H := "+historyString, views.booleanPropertyToString("serialisierbar", isSR)+views.propertyToString("rücksetzbar", history, operationsNotRC)+views.propertyToString("vermeidet kaskadierendes Rücksetzen", history, operationsNotACA)+views.propertyToString("strikt", history, operationsNotST), 12)+"</div>"+printjquery(graph, history) if answers: if answers['SR'] == isSR and answers['RC'] == isRC and answers['ACA'] == isACA and answers['ST'] == isST: returnString = printCheckboxes(answers) + views.getMessageBox("Richtig!","thumbs-up") + resultString else: returnString = printCheckboxes(answers) + views.getMessageBox("Leider falsch!","thumbs-down") else: returnString = printCheckboxes(result) + resultString else: returnString = printCheckboxes(answers) + history return returnString
} else{ $(this).removeClass().addClass("btn btn-danger"); $('span', this).html('<span class="glyphicon glyphicon-flash" aria-hidden="true" onclick="return iconclicked('+this.id+');"></span>'+this.id); } }).change(); </script> <script> function iconclicked(label){ $("#"+label.id).click(); }; </script> </div> </div> """ return returnString try: history = str(form['history'].value) try: quizButton = form['quizbutton'].value #quiz has been sent print html(history) + printResults(history, getUserAnswers(form)) + htmlend except KeyError: #just show the results print html(history) + printResults(history) + htmlend except KeyError: history = views.historyToString(DBtransactions.generateHistory(), False) print html(history)+printCheckboxes()+htmlend