Ejemplo n.º 1
0
def addValidationNeeded(issue,signature,type='online'):
    validation = ValidationResult()
    validation.sunetid = signature.sunetid
    validation.issue = issue
    validation.location = type
    validation.key = randomString(64)
    validation.save()
Ejemplo n.º 2
0
def setup_validate(request):
    TEST_PERCENT = 0.05
    for issue in Issue.objects.all():
        if not issue.public:
            continue

        #online signatures
        osigs = Signature.objects.filter(issue=issue)
        numosigs = len(osigs)
        if numosigs <= 1:
            continue
        num_tested = int(math.floor(numosigs * TEST_PERCENT))
        selected = random.sample(osigs,num_tested)
        for signature in selected:
            validation = ValidationResult()
            validation.sunetid = signature.sunetid
            validation.issue = signature.issue
            validation.location = 'online'
            validation.key = randomString(64)
            validation.save()

        #online signatures
        psigs = PaperSignature.objects.filter(issue=issue)
        numpsigs = len(psigs)
        if numpsigs <= 1:
            continue
        num_tested = int(math.floor(numpsigs * TEST_PERCENT))
        selected = random.sample(psigs,num_tested)
        for signature in selected:
            validation = ValidationResult()
            validation.sunetid = signature.sunetid
            validation.issue = signature.issue
            validation.location = 'paper'
            validation.key = randomString(64)
            validation.save()
    return HttpResponse("Completed")