Exemple #1
0
    def save(self, **kw):
        e = model.Sample().get(request.params['sample_id'])
        if request.params['experiment.experiment_name'] == "Seebeck":
            columns = model.seebeck_columns
            exp = model.SeebeckResult()
            exp.experiment_name = "Seebeck"
            #exp.date = h.string2date(request.params['experiment.date'])
            exp.date = datetime.datetime.utcnow()
            results = []
            results_in = request.params['experiment.results']
            exp.results = h.csv2dict(request.params['experiment.results'], columns)
            exp.notes = request.params['experiment.notes']
            exp.tc_type = request.params['experiment.tc_type']
            exp.vi = request.params['experiment.vi']
            exp.system = request.params['experiment.system']
            e.seebeck_result.append(exp)
        elif request.params['experiment.experiment_name'] == "Resistivity":
            columns = model.rho_columns
            exp = model.RhoResult()
            exp.experiment_name = "Resistivity"
            exp.date = h.string2date(request.params['date'])
            exp.results = h.csv2dict(request.params['results'], columns)
            exp.notes = request.params['notes']
            exp.tc_type = request.params['tc_type']
            exp.vi = request.params['vi']
            exp.system = request.params['system']
            e.rho_result.append(exp)

        e.save()
        h.redirect_to(controller='sample', action='view', host='romny-scientific.com:8080', id=request.params['sample_id'])
Exemple #2
0
 def save(self, **kw):
     e = model.Sample().get(request.params['sample_id'])
     dic = {}
     dic['experiment_name'] = request.params['experiment_name']
     dic['date'] = request.params['date']
     dic['system'] = request.params['system']
     dic['results'] = h.csv2dict(request.params['results'])
     e.experiment_result.append(dic)
     e.save()
     h.redirect_to(controller='sample', action='view', id=request.params['sample_id'])