def get_query(self, app_id, exp_uid, widget_key, args=None): """ Render custom query for app type """ # Make this more flexible next_backend_url = "http://" + config.NEXT_BACKEND_GLOBAL_HOST + ":" + config.NEXT_BACKEND_GLOBAL_PORT # pass in cookie dependent data requested_experiment = Experiment.objects(exp_uid=exp_uid)[0] query_tries = requested_experiment.query_tries debrief = requested_experiment.debrief instructions = requested_experiment.instructions context_type = requested_experiment.params['context_type'] if context_type == 'image': context_content = requested_experiment.params['context_image'] elif context_type == 'text': context_content = requested_experiment.params['context_text'] else: context_content = 'none' template = env.get_template("query.html") return render_template(template, app_id=app_id, exp_uid=exp_uid, widget_key=widget_key, next_backend_url=next_backend_url, query_tries=query_tries, debrief=debrief, instructions=instructions, context_type=context_type, context_content=context_content)
def get_query(self, app_id, exp_uid, widget_key, args=None): """ Render custom query for app type """ # Make this more flexible next_backend_url = "http://"+config.NEXT_BACKEND_GLOBAL_HOST+":"+config.NEXT_BACKEND_GLOBAL_PORT # pass in cookie dependent data requested_experiment = Experiment.objects(exp_uid=exp_uid)[0] query_tries = requested_experiment.query_tries debrief = requested_experiment.debrief instructions = requested_experiment.instructions context_type = requested_experiment.params['context_type'] if context_type == 'image': context_content = requested_experiment.params['context_image'] elif context_type == 'text': context_content = requested_experiment.params['context_text'] else: context_content = 'none' template = env.get_template("query.html") return render_template(template, app_id=app_id, exp_uid = exp_uid, widget_key = widget_key, next_backend_url=next_backend_url, query_tries = query_tries, debrief = debrief, instructions = instructions, context_type=context_type, context_content=context_content)
def getquery(app_id, exp_uid, widget_key): # get experiment requested_experiment = Experiment.objects(exp_uid=exp_uid)[0] # query the app_manager for app specific params app_resource = app_manager.get_app_resource(requested_experiment.app_id) # This is an html string containing the necessary app dashboard. app_query_html = app_resource.get_query(app_id=app_id, exp_uid=exp_uid, widget_key=widget_key) return app_query_html
def getquery(app_id, exp_uid, widget_key): # get experiment requested_experiment = Experiment.objects(exp_uid=exp_uid)[0] # query the app_manager for app specific params app_resource = app_manager.get_app_resource(requested_experiment.app_id) # This is an html string containing the necessary app dashboard. app_query_html = app_resource.get_query( app_id=app_id, exp_uid = exp_uid, widget_key = widget_key) return app_query_html
def clone(experiment_id): set_experiment(experiment_id=experiment_id) # copy current experiment attributes app_id = current_experiment.app_id name = current_experiment.name + '_clone' description = current_experiment.description instructions = current_experiment.instructions debrief = current_experiment.debrief params = current_experiment.params target_set = current_experiment.target_set # create new experiment object experiment = Experiment(name=name, description=description, instructions=instructions, debrief=debrief, app_id=app_id, params=params, target_set=target_set) experiment.save() # Add experiment to the current project current_project.add_experiment(experiment) return redirect(url_for('experiment.edit', experiment_id=experiment.id))
def clone(experiment_id): set_experiment(experiment_id=experiment_id) # copy current experiment attributes app_id = current_experiment.app_id name = current_experiment.name + '_clone' description = current_experiment.description instructions = current_experiment.instructions debrief = current_experiment.debrief params = current_experiment.params target_set = current_experiment.target_set # create new experiment object experiment = Experiment(name=name, description = description, instructions = instructions, debrief = debrief, app_id = app_id, params=params, target_set=target_set) experiment.save() # Add experiment to the current project current_project.add_experiment(experiment) return redirect(url_for('experiment.edit', experiment_id=experiment.id))
def delete(experiment_id): current_project.update(pull__experiments=experiment_id) Experiment.objects(id=experiment_id).delete() set_experiment() return redirect(url_for('project._project', project_id=current_project.id))
def load_experiment(experiment_id): experiments = Experiment.objects(id = experiment_id) if len(experiments) > 0: return experiments[0] else: return None
def load_experiment(experiment_id): experiments = Experiment.objects(id=experiment_id) if len(experiments) > 0: return experiments[0] else: return None