def post(self, request): check_issues_exist() request_data = request.data.copy() user = request.user request_data["predictions_table"] = get_predictions_table_settings( user) request_data["source_field"] = get_source_field(user) update_resolutions(request_data, user) remove_cache_record("settings:predictions_table", user.id) training_serializer = UserTrainingSerializer(data=request_data) training_serializer.is_valid(raise_exception=True) update_bug_resolutions(user, training_serializer.data["bug_resolution"]) update_mark_up_entities(user, training_serializer.data["mark_up_entities"]) remove_training_parameters(user) return Response({"result": "success"})
def get(self, request): check_issues_exist() qa_metrics_settings = get_qa_metrics_settings(request.user) names = sorted(get_fields()) result = {"filter_settings": qa_metrics_settings, "names": names} return Response(result)
def get(self, request): check_issues_exist() resolution_settings = get_bug_resolutions(request.user) resolution = get_unique_values("Resolution") result = { "resolution_settings": resolution_settings, "resolution_names": resolution, } return Response(result)
def get(self, request): check_issues_exist() source_field = get_source_field(request.user) source_field_names = sorted(get_fields()) result = { "source_field": source_field, "source_field_names": source_field_names, } return Response(result)
def get(self, request): check_issues_exist() predictions_table_settings = get_predictions_table_settings( request.user) result = { "predictions_table_settings": predictions_table_settings, "field_names": sorted(get_fields()), } return Response(result)
def post(self, request): check_issues_exist() request_data = request.data.copy() read_settings(request_data, request.user) filter_settings_serializer = UserFilterSerializer(data=request_data, many=True) filter_settings_serializer.is_valid(raise_exception=True) UserFilterSerializer.delete_old_filters(request_data[0]["settings"]) filter_settings_serializer.save() clear_page_cache(["analysis_and_training"], request.user.id) return Response({"result": "success"})
def get(self, request): check_issues_exist() mark_up_entities = get_mark_up_entities(request.user) source_field = get_source_field(request.user) if not source_field: return Response({}) unique_values = get_unique_values(source_field) unique_values = split_values(unique_values) result = { "mark_up_entities": mark_up_entities, "entity_names": sorted(unique_values), } return Response(result)
def post(self, request): check_issues_exist() request_data = request.data.copy() read_settings(request_data, request.user) settings_serializer = UserPredictionsTableSerializer(data=request_data, many=True) settings_serializer.is_valid(raise_exception=True) UserPredictionsTableSerializer.delete_old_fields( request_data[0]["settings"]) settings_serializer.save() clear_cache( ["qa_metrics:predictions_page", "qa_metrics:predictions_table"], request.user.id, ) return Response({"result": "success"})
def post(self, request): check_issues_exist() request_data = request.data.copy() read_settings(request_data, request.user) settings_serializer = UserQAMetricsFilterSerializer(data=request_data, many=True) settings_serializer.is_valid(raise_exception=True) UserQAMetricsFilterSerializer.delete_old_filters( request_data[0]["settings"]) settings_serializer.save() remove_cache_record("qa_metrics:filters", request.user.id) redis_conn.set( f"user:{request.user.id}:settings:qa_metrics", dumps(get_qa_metrics_settings(request.user)), ) return Response({"result": "success"})