예제 #1
0
def _blank_Exp(blankName):
    # create blank experiment if doesn't already exist
    try:
        ret = Experiment.objects.get(expName=blankName)
    except Experiment.DoesNotExist:
        kwargs = {}
        for field in Experiment._meta.fields:
            if field.name == 'expName':
                kwargs[field.name] = blankName
            elif field.name == 'date':
                kwargs[field.name] = datetime.now()
            elif not field.null:
                if field.get_internal_type() == 'CharField' or field.get_internal_type() == 'TextField':
                    kwargs[field.name] = ""
            elif field.get_internal_type() == 'BooleanField':
                kwargs[field.name] = False
            elif field.get_internal_type() == 'IntegerField':
                kwargs[field.name] = 0
            else:  # only id should remain
                logging.debug(field.name, field.get_internal_type())
        kwargs['cycles'] = 1
        kwargs['flows'] = 1
        kwargs['ftpStatus'] = 'Complete'
        ret = Experiment(**kwargs)
        ret.save()
    return ret
예제 #2
0
파일: views.py 프로젝트: aidjek/TS
def _blank_Exp(blankName):
    # create blank experiment if doesn't already exist
    try:
        ret = Experiment.objects.get(expName=blankName)
    except Experiment.DoesNotExist:
        kwargs = {}
        for field in Experiment._meta.fields:
            if field.name == 'expName':
                kwargs[field.name] = blankName
            elif field.name == 'date':
                kwargs[field.name] = datetime.now()
            elif not field.null:
                if field.get_internal_type(
                ) == 'CharField' or field.get_internal_type() == 'TextField':
                    kwargs[field.name] = ""
            elif field.get_internal_type() == 'BooleanField':
                kwargs[field.name] = False
            elif field.get_internal_type() == 'IntegerField':
                kwargs[field.name] = 0
            else:  # only id should remain
                logging.debug(field.name, field.get_internal_type())
        kwargs['cycles'] = 1
        kwargs['flows'] = 1
        kwargs['ftpStatus'] = 'Complete'
        ret = Experiment(**kwargs)
        ret.save()
    return ret
예제 #3
0
파일: views.py 프로젝트: Jorges1000/TS
def _blank_Exp(blankName):
    # create blank experiment if doesn't already exist
    try:
        ret = Experiment.objects.get(expName=blankName)
    except Experiment.DoesNotExist:
        kwargs = {}
        for field in Experiment._meta.fields:
            if field.name == "expName":
                kwargs[field.name] = blankName
            elif field.name == "date":
                kwargs[field.name] = datetime.now()
            elif not field.null:
                if field.get_internal_type() == "CharField" or field.get_internal_type() == "TextField":
                    kwargs[field.name] = ""
            elif field.get_internal_type() == "BooleanField":
                kwargs[field.name] = False
            elif field.get_internal_type() == "IntegerField":
                kwargs[field.name] = 0
            else:  # only id should remain
                logging.debug(field.name, field.get_internal_type())
                pass
        kwargs["cycles"] = 1
        kwargs["flows"] = 1
        kwargs["barcodeId"] = ""
        ret = Experiment(**kwargs)
        ret.save()
    return ret
예제 #4
0
def create_result(self):
    exp = Experiment()
    exp.date = datetime.now()
    exp.cycles = 0
    exp.flows = 0
    exp.unique = uuid.uuid1()
    exp.save()
    result = Results()
    result.resultsName = 'foo'
    result.experiment = exp
    result.processedCycles = 0
    result.processedflows = 0
    result.framesProcessed = 0
    result.save()
    self.assertIsNotNone(result.id, 'Result id is None')
    return result
예제 #5
0
def create_result(self):
    exp = Experiment()
    exp.date = datetime.now()
    exp.cycles = 0
    exp.flows = 0
    exp.unique = uuid.uuid1()
    exp.save()
    result = Results()
    result.resultsName = 'foo'
    result.experiment = exp
    result.processedCycles = 0
    result.processedflows = 0
    result.framesProcessed = 0
    result.save()
    self.assertIsNotNone(result.id, 'Result id is None')
    return result