def get(self, project_id, site_id, instrument_id): logger.debug("top of GET /measurements") inst_result = meta.get_instrument(project_id, site_id, instrument_id) logger.debug(inst_result) if len(inst_result) > 0: result, msg = chords.get_measurements( str(inst_result[0]['chords_inst_id'])) logger.debug(result) return utils.ok(result=result, msg=msg)
def post(self, project_id, site_id, instrument_id): #logger.debug(type(request.json)) logger.debug(request.json) #TODO loop through list objects to support buld operations if type(request.json) is dict: body = request.json else: body = request.json[0] inst_result, bug = meta.get_instrument(project_id, site_id, instrument_id) # id, name, instrument_id, shortname, commit postInst = ChordsVariable("test", inst_result['chords_id'], body['var_name'], body['var_id'], "") logger.debug(postInst) chord_result, chord_msg = chords.create_variable(postInst) if chord_msg == "Variable created": body['chords_id'] = chord_result['id'] result, msg = meta.create_variable(project_id, site_id, instrument_id, body) else: message = chord_msg logger.debug(result) return utils.ok(result=result, msg=msg)
def get(self, project_id, site_id, instrument_id): #result,msg = chords.get_instrument(instrument_id) result, msg = meta.get_instrument(project_id, site_id, instrument_id) return utils.ok(result=result, msg=msg)