Example #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'])
Example #2
0
 def save(self, **kw):
     e = model.Sample().get(request.params['sample_id'])
     note = model.Note()
     note['date'] = h.string2date(request.params['date'])
     note['text'] = request.params['text']
     e.notes.append(note)
     e.save()
     h.redirect_to(controller='sample', host='romny-scientific.com:8080', action='view', id=request.params['sample_id'])