Commit 5657cb4e by vida092

snib bug arreglado

parent de6d12af
...@@ -1265,12 +1265,11 @@ var module_nicho = (function () { ...@@ -1265,12 +1265,11 @@ var module_nicho = (function () {
// if (rango_fechas[0] == $("#sliderFecha").slider("option", "min") && rango_fechas[1] == $("#sliderFecha").slider("option", "max")) { // if (rango_fechas[0] == $("#sliderFecha").slider("option", "min") && rango_fechas[1] == $("#sliderFecha").slider("option", "max")) {
// rango_fechas = undefined; // rango_fechas = undefined;
// } // }
// subgroups [{type groupid title value}{}]
console.log( subgroups) console.log( subgroups)
var chkFecha = $("#chkFecha").is(':checked'); var chkFecha = $("#chkFecha").is(':checked');
//slider_value = val_process ? $("#sliderValidation").slider("value") : 0; //slider_value = val_process ? $("#sliderValidation").slider("value") : 0;
var slider_value = val_process ? true : false; var slider_value = val_process ? true : false;
_componente_fuente.getBodyElements() _componente_fuente.getBodyElements()
...@@ -1317,6 +1316,10 @@ var module_nicho = (function () { ...@@ -1317,6 +1316,10 @@ var module_nicho = (function () {
"lim_sup_validation": "2021-07-02" "lim_sup_validation": "2021-07-02"
} }
console.log(" <===== body para el análisis =====>")
console.log(body.covariables)
console.log(body.covariable_filter)
// Falta agregar la condición makesense. // Falta agregar la condición makesense.
...@@ -1405,6 +1408,10 @@ var module_nicho = (function () { ...@@ -1405,6 +1408,10 @@ var module_nicho = (function () {
// _componente_target = _variable_module_nicho.createSelectorComponent("var_target", ids_comp_variables[1], "", false, true, true, 4); // _componente_target = _variable_module_nicho.createSelectorComponent("var_target", ids_comp_variables[1], "", false, true, true, 4);
_componente_target = _variable_module_nicho.createSelectorComponent("var_target", ids_comp_variables[1], "", false, true, true); _componente_target = _variable_module_nicho.createSelectorComponent("var_target", ids_comp_variables[1], "", false, true, true);
var targetChildDiv = $('#tab_content_target').find('div').first();
// Change the id attribute of the child div
targetChildDiv.attr('id', 'tab0_target');
// enlazando los modulos que tienen interacción en los procesos // enlazando los modulos que tienen interacción en los procesos
_res_display_module_nicho.startResDisplay(_map_module_nicho, _histogram_module_nicho, _table_module, _language_module_nicho, ids_comp_variables); _res_display_module_nicho.startResDisplay(_map_module_nicho, _histogram_module_nicho, _table_module, _language_module_nicho, ids_comp_variables);
......
...@@ -717,6 +717,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -717,6 +717,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
_VERBOSE ? console.log("error: " + textStatus) : _VERBOSE; _VERBOSE ? console.log("error: " + textStatus) : _VERBOSE;
} }
}); });
...@@ -1014,9 +1015,9 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1014,9 +1015,9 @@ var res_display_module = (function (verbose, url_zacatuche) {
_TREE_GENERATED.groups.push({index: (index + 1), name: grupo.title}); _TREE_GENERATED.groups.push({index: (index + 1), name: grupo.title});
} }
// _VERBOSE ? console.log(_TREE_GENERATED) : _VERBOSE; //_VERBOSE ? console.log(_TREE_GENERATED) : _VERBOSE;
// var filterby_group = []; //var filterby_group = [];
_VERBOSE ? console.log(grupo) : _VERBOSE; _VERBOSE ? console.log(grupo) : _VERBOSE;
var hasChildren = false; var hasChildren = false;
...@@ -1028,7 +1029,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1028,7 +1029,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
temp_group.hasChildren = hasChildren; temp_group.hasChildren = hasChildren;
temp_group.groupid = grupo.groupid; temp_group.groupid = grupo.groupid;
console.log(grupo)
grupo.value.forEach(function (item) { grupo.value.forEach(function (item) {
// if item is type 1 is a json and if 0 is a string // if item is type 1 is a json and if 0 is a string
...@@ -1119,14 +1120,52 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1119,14 +1120,52 @@ var res_display_module = (function (verbose, url_zacatuche) {
console.log("_REQUESTS_NUMBER: " + _REQUESTS_NUMBER); console.log("_REQUESTS_NUMBER: " + _REQUESTS_NUMBER);
// console.log(_TREE_GENERATED); // console.log(_TREE_GENERATED);
// console.log(_REQUESTS_MADE); console.log("</////////// ******* request made ******///////////> ")
console.log(_REQUESTS_MADE);
console.log("se empiezan a generar las peticiones")
console.log(body)
// Obtener la cantidad de elementos en "covariables"
const covariablesCount = body.covariables.length;
// Crear las copias del JSON y actualizar "covariable_filter"
const copies = [];
for (let i = 0; i < covariablesCount; i++) {
const copy = JSON.parse(JSON.stringify(body)); // Copia profunda del JSON original
copy.covariables = [body.covariables[i]]; // Cambiar el valor de "covariables"
// return; // Actualizar "covariable_filter" solo si los valores son iguales
if (body.covariable_filter && body.covariable_filter[body.covariables[i]]) {
copy.covariable_filter = {
[body.covariables[i]]: body.covariable_filter[body.covariables[i]]
};
} else {
copy.covariable_filter = null;
}
copies.push(copy);
}
_REQUESTS_MADE.forEach(function (item, index) {
// Imprimir las copias
copies.forEach((copy, index) => {
console.log(`Copia ${index + 1}:`, copy);
});
copies.forEach(function (item, index) {
_createScore_Decil(item); _createScore_Decil(item);
}); });
// _REQUESTS_MADE.forEach(function (item, index) {
// _createScore_Decil(item);
// });
//// aquí hay que modificar el body por cada covariable
} }
...@@ -1143,8 +1182,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1143,8 +1182,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
* @param {boolean} isTotal - Bandera que indica si la configuración enviada es el total de los conjuntos de las variables seleccionadas * @param {boolean} isTotal - Bandera que indica si la configuración enviada es el total de los conjuntos de las variables seleccionadas
*/ */
function _createScore_Decil(decildata) { function _createScore_Decil(decildata) {
console.log(decildata)
_VERBOSE ? console.log("_createScore_Decil") : _VERBOSE; _VERBOSE ? console.log("_createScore_Decil") : _VERBOSE;
...@@ -1158,6 +1196,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1158,6 +1196,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
data_request["decil_selected"] = [_default_decil] data_request["decil_selected"] = [_default_decil]
console.log("<====================================================>1") console.log("<====================================================>1")
console.log(data_request) console.log(data_request)
console.log(_TREE_GENERATED)
// decildata["with_data_freq"] = false; // decildata["with_data_freq"] = false;
...@@ -1173,7 +1212,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1173,7 +1212,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
fetch("https://covid19.c3.unam.mx/gateway/api/analysis/cells/",{ fetch("https://covid19.c3.unam.mx/gateway/api/analysis/cells/",{
method:"POST", method:"POST",
//body: JSON.stringify(data_request), //body: JSON.stringify(data_request),
body: JSON.stringify(body), body: JSON.stringify(decildata),
headers:{ headers:{
"Content-Type": "application/json" "Content-Type": "application/json"
} }
...@@ -1181,7 +1220,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1181,7 +1220,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
.then(resp => resp.json()) .then(resp => resp.json())
.then(respuesta => { .then(respuesta => {
console.log("<====================================================>2") console.log("<===================== RESPUESTA ===============================>2")
console.log(respuesta) console.log(respuesta)
console.log(">====================================================<2") console.log(">====================================================<2")
...@@ -1193,25 +1232,30 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1193,25 +1232,30 @@ var res_display_module = (function (verbose, url_zacatuche) {
} }
///talvez modificar ///talvez modificar
_REQUESTS_NUMBER = 0; console.log("----PETICIONES----")
console.log(_REQUESTS_NUMBER)
_REQUESTS_NUMBER = _REQUESTS_NUMBER - 1;
console.log("----PETICIONES MENOS UNO----")
console.log(_REQUESTS_NUMBER)
// PROCESANDO PETICIONES INDIVIDUALES // PROCESANDO PETICIONES INDIVIDUALES
//var data_response = jQuery.extend(true, [], respuesta.data); var data_response = jQuery.extend(true, [], respuesta.data);
var data_response = respuesta.data //var data_response = respuesta.data
console.log(data_response) console.log(data_response)
var validation_data = respuesta.validation_data var validation_data = respuesta.validation_data
processSingleResponse(data_response, data_request, validation_data); processSingleResponse(data_response, data_request, validation_data);
console.log("<-------- _REQUEST_DONE BEFORE PUSH RESPONSE ------->")
console.log(_REQUESTS_DONE) console.log(_REQUESTS_DONE)
_REQUESTS_DONE.push(respuesta); _REQUESTS_DONE.push(respuesta);
console.log("****************-------********") console.log("<-------- _REQUEST_DONE AFTER RESPONSE ------->")
console.log(_REQUESTS_DONE) console.log(_REQUESTS_DONE)
_REQUESTS_DONE=_REQUESTS_DONE.slice(0,1) _REQUESTS_DONE=_REQUESTS_DONE.slice(0,1)
console.log("****************-------********") console.log("<-------- _REQUEST_DONE AFTER SLICE ------->")
console.log(_REQUESTS_DONE) console.log(_REQUESTS_DONE)
// todas las peticiones han sido realizadas // todas las peticiones han sido realizadas
...@@ -1285,14 +1329,18 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1285,14 +1329,18 @@ var res_display_module = (function (verbose, url_zacatuche) {
console.log(_TREE_GENERATED); console.log(_TREE_GENERATED);//
// console.log(_TREE_GENERATED.groups); // console.log(_TREE_GENERATED.groups);
var score_cell_byanalysis = []; var score_cell_byanalysis = [];
var names_byanalysis = []; var names_byanalysis = [];
var decil_total_results = [] var decil_total_results = []
_TREE_GENERATED.groups.forEach(function (group) { _TREE_GENERATED.groups.forEach(function (group) {
console.log(group)
var score_cell_bygroup = []; var score_cell_bygroup = [];
var names_bygroup = []; var names_bygroup = [];
...@@ -1329,7 +1377,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1329,7 +1377,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
}); });
console.log("<----------------_TREE_GENERATED-------------------------->")
console.log(_TREE_GENERATED)
if (_TREE_GENERATED.hasTotal) { if (_TREE_GENERATED.hasTotal) {
...@@ -1354,6 +1403,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1354,6 +1403,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
verbo = _val_process_temp ? "countsTaxonsGroupTimeValidation" : "countsTaxonsGroup" verbo = _val_process_temp ? "countsTaxonsGroupTimeValidation" : "countsTaxonsGroup"
///ojo ///ojo
console.log("<------------------------ULTIMA PETICION----------------------------->")
console.log(body)
fetch("https://covid19.c3.unam.mx/gateway/api/analysis/cells/",{ fetch("https://covid19.c3.unam.mx/gateway/api/analysis/cells/",{
method:"POST", method:"POST",
...@@ -1389,8 +1440,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1389,8 +1440,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
// console.log("total_counts: " + total_counts.length) // console.log("total_counts: " + total_counts.length)
// console.log(decil_cells) // console.log(decil_cells)
console.log(percentage_avg)
console.log("<====================================================>8") console.log("<====================================================>8")
console.log(percentage_avg)
console.log(validation_data) console.log(validation_data)
console.log(data_score_cell) console.log(data_score_cell)
console.log(">====================================================<8") console.log(">====================================================<8")
...@@ -1443,10 +1494,6 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1443,10 +1494,6 @@ var res_display_module = (function (verbose, url_zacatuche) {
$('#chartdiv_score_decil').loading('stop'); $('#chartdiv_score_decil').loading('stop');
} }
} }
}) })
...@@ -1947,6 +1994,64 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1947,6 +1994,64 @@ var res_display_module = (function (verbose, url_zacatuche) {
} }
/**
* Enlaza los datos configurados de la petición con los datos de validación de la repuesta del análisis
*
* @function bindResponseWithValidation
*
* @param {array} data - Array con la colección de scores por celda.
* @param {array} data_request - Array con la configuración utilizada para generar el análisis de nicho. Esta configuración es la utilizada por cada grupo de variables seleccionado.
* @param {array} validation_data - Array con el resultado del proceso de validación cuando este es solicitado.
*
*/
function bindResponseWithValidation(data, data_request, validation_data = []) {
_VERBOSE ? console.log("bindResponseWithValidation") : _VERBOSE;
_TREE_GENERATED.groups.forEach(function (group_item, index) {
console.log(group_item);
console.log(data_request);
if (group_item.groupid === data_request.covariables[0].group_item) {
group_item.children.forEach(function (child, index) {
if (child.value === data_request.covariables[0].merge_vars[0].value) {
// var data_score_cell = _utils_module.processDataForScoreCell(data);
// child.response = data_score_cell;
child.response = data;
child.validation_data = validation_data
if (data_request.groupid !== undefined || data_request.covariables !== undefined) {
// var title_valor = _utils_module.processTitleGroup(data_request.groupid, data_request.covariables);
// child.title_valor = title_valor;
child.title_valor = JSON.stringify({'title': 'Grupo Bio ' + data_request.groupid,
'type': 0,
'group_item': data_request.covariables[0].group_item,
'is_parent': true});
child.request = data_request;
}
}
});
}
});
_TREE_GENERATED.groups.forEach(group =>{
console.log(group)
})
}
/** /**
* Éste método envía el conjunto de parámetros al módulo table para generar la tabla de resultados de épsilon y score en el análisis de nicho ecológico. * Éste método envía el conjunto de parámetros al módulo table para generar la tabla de resultados de épsilon y score en el análisis de nicho ecológico.
......
...@@ -348,10 +348,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -348,10 +348,7 @@ var variable_module = (function (verbose, url_zacatuche) {
}) })
}) })
console.log(familias)
console.log(generos)
console.log(nombrescientificos)
console.log(data)
$('#jstree_variables_species_target').on('open_node.jstree', self.getTreeVar); $('#jstree_variables_species_target').on('open_node.jstree', self.getTreeVar);
$("#jstree_variables_species_target").on('changed.jstree', self.getChangeTreeVarTarget); $("#jstree_variables_species_target").on('changed.jstree', self.getChangeTreeVarTarget);
$("#jstree_variables_species_target").on('loaded.jstree', self.loadNodes); $("#jstree_variables_species_target").on('loaded.jstree', self.loadNodes);
...@@ -763,12 +760,13 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -763,12 +760,13 @@ var variable_module = (function (verbose, url_zacatuche) {
name_class = 'active nav-variables'; name_class = 'active nav-variables';
} }
var li = $('<li/>') var li = $('<li/>')
.addClass(name_class) .addClass(name_class)
.appendTo(nav_items) .appendTo(nav_items)
.click(function (e) { .click(function (e) {
console.log( e.target.getAttribute('href') )
$('.nav-tabs a[href="' + e.target.getAttribute('href') + '"]').tab('show'); $('.nav-tabs a[href="' + e.target.getAttribute('href') + '"]').tab('show');
e.preventDefault(); e.preventDefault();
}); });
...@@ -779,13 +777,13 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -779,13 +777,13 @@ var variable_module = (function (verbose, url_zacatuche) {
.text(_iTrans.prop(tags[i])) .text(_iTrans.prop(tags[i]))
.appendTo(li);tags .appendTo(li);tags
console.log(tags[i]) console.log(tags[i])
}
});
}
});
// div que alamcena el cuerpo de los tabs // div que alamcena el cuerpo de los tabs
var tab_content = $('<div/>') var tab_content = $('<div/>')
...@@ -801,7 +799,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -801,7 +799,7 @@ var variable_module = (function (verbose, url_zacatuche) {
//_VERBOSE ? console.log(tags[i]) : _VERBOSE; //_VERBOSE ? console.log(tags[i]) : _VERBOSE;
//div del tab[i]_id //div del tab[i]_id
var tab_pane = $('<div/>') var tab_pane = $('<div/>')
.attr('id', 'tab' + i + "_" + "target") .attr('id', 'tab' + i + "_" + "fuente")
.addClass('tab-pane active') .addClass('tab-pane active')
.appendTo(tab_content); .appendTo(tab_content);
//div id="tab_content_fuente" & class="tab-content" //div id="tab_content_fuente" & class="tab-content"
...@@ -810,7 +808,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -810,7 +808,7 @@ var variable_module = (function (verbose, url_zacatuche) {
.appendTo(drop_item); .appendTo(drop_item);
var btn_sp = $('<button/>') var btn_sp = $('<button/>')
.attr('id', 'btn_variable' + "_" + "target") .attr('id', 'btn_variable' + "_" + "fuente")
.attr('type', 'button') .attr('type', 'button')
.attr('data-toggle', 'dropdown') .attr('data-toggle', 'dropdown')
.attr('aria-haspopup', 'true') .attr('aria-haspopup', 'true')
...@@ -1605,11 +1603,6 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1605,11 +1603,6 @@ var variable_module = (function (verbose, url_zacatuche) {
.addClass('tab-pane') .addClass('tab-pane')
.appendTo(tab_content) .appendTo(tab_content)
// contendor de arbol y panel de seleccion // contendor de arbol y panel de seleccion
var tree_nav_container = $('<div/>') var tree_nav_container = $('<div/>')
.addClass('row nav_species_container') .addClass('row nav_species_container')
...@@ -1623,10 +1616,6 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1623,10 +1616,6 @@ var variable_module = (function (verbose, url_zacatuche) {
var tree = $('<div/>') var tree = $('<div/>')
.attr('id', "jstree_variables_bioclim_" + id) .attr('id', "jstree_variables_bioclim_" + id)
.appendTo(div_tree); .appendTo(div_tree);
var btn_add = $('<button/>') var btn_add = $('<button/>')
.attr('id', 'add_group_bioclim' + "_" + id) .attr('id', 'add_group_bioclim' + "_" + id)
.attr('type', 'button') .attr('type', 'button')
...@@ -2487,6 +2476,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2487,6 +2476,7 @@ var variable_module = (function (verbose, url_zacatuche) {
for (i = 0; i < arraySelected.length; i++) { for (i = 0; i < arraySelected.length; i++) {
console.log(arraySelected[i])
// se elimita el spp del label cuando es tipo BIO // se elimita el spp del label cuando es tipo BIO
if (typeVar == _TYPE_BIO) { if (typeVar == _TYPE_BIO) {
...@@ -2502,6 +2492,12 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2502,6 +2492,12 @@ var variable_module = (function (verbose, url_zacatuche) {
} }
console.log("--------------------------------------------------------------------------------------")
console.log(subgroup)
console.log("--------------------------------------------------------------------------------------")
var groupid = parseInt(maxGroup) + 1; var groupid = parseInt(maxGroup) + 1;
console.log("maxGroup: " + maxGroup); console.log("maxGroup: " + maxGroup);
console.log("groupid: " + groupid); console.log("groupid: " + groupid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment