Esempio n. 1
0
def printQuizStart(string):
    x = DBnormalizer.parseInput(string)
    if len(x) < 3:
        return x[0]
    else:
        relation = x[0]
        fds = x[1][:]
        mvds = x[2][:]
        return quizForms.formQuizStart(relation, fds, mvds)
Esempio n. 2
0
def printResults(string):
    x = DBnormalizer.parseInput(string)
    if len(x) < 3:
        return x[0]
    else:
        relation = x[0]
        fds = x[1][:]
        mvds = x[2][:]
        numberOfAttributes = x[3]
        result = DBnormalizer.computeEverything(relation, fds, mvds)
        return views.resultToString(relation, x[1], x[2], result)
Esempio n. 3
0
                   funMode) + views.getAlgorithmTutorial() + htmlend
    elif mode == 'generateMvds':
        relation, fds, mvds = DBnormalizer.generateNewProblem(
            numberOfAttributes, True, funMode)
        print html(views.setOfAttributesToString(relation),
                   views.fdsToString(fds) + views.mvdsToString(mvds),
                   numberOfAttributes,
                   funMode) + views.getAlgorithmTutorial() + htmlend
    else:
        #Mode is showResults or Quiz
        relation = str(form['relation'].value)
        fds = str(form['fds'].value)
        input = "[" + relation + "][" + fds + "][" + str(
            int(numberOfAttributes)) + "]"
        if mode == 'quiz':
            x = DBnormalizer.parseInput(input)
            if len(x) < 3:
                print html(relation, fds, numberOfAttributes,
                           funMode) + printResults(input) + htmlend
            else:
                print htmlstart() + printQuizStart(input) + htmlend
        else:
            print html(relation, fds, numberOfAttributes,
                       funMode) + printResults(input) + htmlend
except KeyError:
    try:
        funMode = int(form['fun'].value)
    except:
        funMode = 0
    relation, fds, mvds = DBnormalizer.generateNewProblem(
        numberOfAttributes, False, funMode)