bug fixing CORRELATION

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@178521 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-03-08 16:38:40 +00:00
parent daecdba666
commit 459e7d52d1
3 changed files with 88 additions and 21 deletions

View File

@ -164,10 +164,12 @@ public class PerformFishAnalyticsController {
viewController.manageKPI(selectedKPI.getKpi(), selectedKPI.isChecked(), selectedKPI.getSelectedPopulationType());
int selectedKPIsSize = viewController.getSelectedKPIs().size();
boolean isValidForm = viewController.validatePerformFishInputFields();
if(isValidForm) {
//viewController.manageAlgorithmsSubmit(selectedKPIsSize);
List<String> batchIds = viewController.getSelectedBatchID();
if(batchIds==null || batchIds.size()==0) {
viewController.enableAllAlgorithmsForSubmit(false);
}else
viewController.manageAlgorithmsSubmit(selectedKPIsSize);
}
}
});
@ -446,7 +448,8 @@ public class PerformFishAnalyticsController {
case SCATTER:
if(inputKPI.get(0)==null || inputKPI.get(1)==null){
submitRequestPanel.setTheTitle("Something seems wrong, one or more of the selected KPIs are not valid. Please try again");
submitRequestPanel.setTheTitle("Sorry, something seems wrong, the selected KPIs are not valid. Please try again");
checkTabSpinner(submitRequestPanel, tab);
return;
// Window.alert("Something seems wrong, no selected BatchID, try again");
}

View File

@ -312,23 +312,46 @@ public class AnalyticsPanelResult extends Composite {
}
/**
* Gets the KPI for name.
*
* @param name the name
* @return the KPI for name
*/
// /**
// * Gets the KPI for name.
// *
// * @param name the name
// * @return the KPI for name
// */
// public KPI getKPIForName(String name){
//
// //GWT.log("Selected KPIs: "+selectedKPIs);
// GWT.log("Searching KPI name: "+name);
// KPI foundKPI = null;
// //String purgedName = name.replaceAll("\\%", "").trim();
// String purgedName = name.trim();
// for (KPI kpi : selectedKPIs) {
// //String purgedKPIName = kpi.getName().replaceAll("\\%", "").trim();
// String purgedKPIName = kpi.getName().trim();
// if(purgedKPIName.compareToIgnoreCase(purgedName)==0) {
// foundKPI = kpi;
// break;
// }
//
// }
// GWT.log("FOUND KPI: "+foundKPI);
// return foundKPI;
// }
public KPI getKPIForName(String name){
System.out.println("Selected KPIs: "+selectedKPIs);
String purgedName = name.replaceAll("\\%", "").trim();
GWT.log("Searching KPI name: "+name);
KPI foundKPI = null;
String purgedName = name.trim();
for (KPI kpi : selectedKPIs) {
String purgedKPIName = kpi.getName().replaceAll("\\%", "").trim();
if(purgedKPIName.compareToIgnoreCase(purgedName)==0)
return kpi;
String purgedKPIName = kpi.getName().trim();
if(purgedKPIName.compareToIgnoreCase(purgedName)==0) {
foundKPI = kpi;
break;
}
}
return null;
GWT.log("FOUND KPI: "+foundKPI);
return foundKPI;
}
/**
@ -452,7 +475,7 @@ public class AnalyticsPanelResult extends Composite {
@Override
public void onSuccess(CSVFile result) {
GWT.log("Displaying: "+result);
HorizontalPanel hp = new HorizontalPanel();
final FlexTable flexTable = new FlexTable();
@ -460,7 +483,11 @@ public class AnalyticsPanelResult extends Composite {
flexTable.getElement().getStyle().setMarginBottom(10, Unit.PX);
flexTable.setWidget(0, 0,new Label(""));
// for (KPI kpi : selectedKPIs) {
// GWT.log("Selected KPIs are: "+kpi);
// }
CSVRow headerRow = result.getHeaderRow();
//HEADER
for (int i=1; i<headerRow.getListValues().size(); i++) {
@ -613,7 +640,7 @@ public class AnalyticsPanelResult extends Composite {
*/
private void fillKPIReferenceForIndex(int rowIndex, int columnIndex, List<KPI> listKPI){
String key = rowIndex+","+columnIndex;
String key = generateKey(rowIndex, columnIndex);
kpiMapPointers.put(key, listKPI);
// String kpiNames = "";
@ -641,9 +668,13 @@ public class AnalyticsPanelResult extends Composite {
* @return the KPI for indexes
*/
public List<KPI> getKPIForIndexes(int rowIndex, int columnIndex){
String key = rowIndex+","+columnIndex;
String key = generateKey(rowIndex, columnIndex);
return kpiMapPointers.get(key);
}
private String generateKey(int rowIndex, int columnIndex) {
return rowIndex+"-"+columnIndex;
}
/**

View File

@ -2,6 +2,7 @@
package org.gcube.portlets.user.performfishanalytics.client.viewbinder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -11,6 +12,7 @@ import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationT
import org.gcube.portlets.user.performfishanalytics.client.event.PerformFishFieldFormChangedEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedPopulationTypeEvent;
import org.gcube.portlets.user.performfishanalytics.shared.Area;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.Period;
import org.gcube.portlets.user.performfishanalytics.shared.Population;
import org.gcube.portlets.user.performfishanalytics.shared.PopulationType;
@ -209,7 +211,38 @@ public class PerformFishAnalitycsFormView extends Composite {
selectAllFields(field_select_area, isChecked);
}
});
// KPI kpi = new KPI("", "", "Number fish/FTE employees in 2nd year", "", null, null, 1);
// getKPIForName("Number fish/FTE employees in 2nd year", Arrays.asList(kpi));
}
// /**
// * Gets the KPI for name.
// *
// * @param name the name
// * @return the KPI for name
// */
// public KPI getKPIForName(String name, List<KPI> selectedKPIs){
//
// //GWT.log("Selected KPIs: "+selectedKPIs);
// GWT.log("Searching name: "+name);
// KPI foundKPI = null;
// String purgedName = name.replace("\\", "\\\\");
// GWT.log("Purged name: "+purgedName);
// //String purgedName = name.trim();
// for (KPI kpi : selectedKPIs) {
// String purgedKPIName = kpi.getName().replace("\\", "\\\\");
// GWT.log("Purged Selected KPI name: "+purgedName);
// //String purgedKPIName = kpi.getName().trim();
// if(purgedKPIName.compareToIgnoreCase(purgedName)==0) {
// foundKPI = kpi;
// break;
// }
//
// }
// GWT.log("FOUND KPI: "+foundKPI);
// return foundKPI;
// }
/**
* Select all fields.