From 69ad616ef7da18c8a9bb153f8fc15af8af67241a Mon Sep 17 00:00:00 2001 From: John Parrell Date: Thu, 15 Apr 2021 17:21:26 -0400 Subject: [PATCH] Fixed variable map --- .../WaterWay/WaterWayFormFragment.java | 179 ++++++++++-------- 1 file changed, 100 insertions(+), 79 deletions(-) diff --git a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java index 975cd2c..2ee9971 100644 --- a/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java +++ b/app/src/main/java/com/sf/stormwaterutilityandroid/WaterWay/WaterWayFormFragment.java @@ -48,6 +48,11 @@ public class WaterWayFormFragment extends Fragment { + FormElementTextSingleLine name, site, date, outfallValue, longitudeValue, latitudeValue, invertElevationValue; + FormElementPickerSingle subSize, smothering, silting, rootwads, overhangingVeg, oxbows, downed, shallows, waterPlants, deepPools, logs, boulders, undercutBanks, sinuosity, natural, riparianWidth, landUse, bankErosion, streamShading, deepestPool, velocityForm, riffleDepth, riffleSub; + FormElementSwitch flow, odor, color, polutants, obstruction, maintenance, screen; + FormElementTextNumber temperature, tubidity, pH, nitrate, phosphate, oxygen, coli, other1, other2, intolerant, moderatelyTolerant, fairlyTolerant, veryTolerant; + FormElementPickerMulti typeValue, pipeSizeValue, channelBottomWidthValue, receiving; //Gen Form Variable Initialization String nameOfInspector = ""; String nameOfSite = ""; @@ -198,9 +203,95 @@ public void onClick(View v) { Map WaterWayBoolFields = new HashMap(); Map WaterWayStringFields = new HashMap(); + + tempVal = Double.parseDouble(temperature.getValue() ); + turbidityVal = Double.parseDouble(tubidity.getValue() ); + phVal = Double.parseDouble(pH.getValue() ); + nitrateVal = Double.parseDouble(nitrate.getValue() ); + phosphateVal = Double.parseDouble(phosphate.getValue() ); + oxygenVal = Double.parseDouble(oxygen.getValue() ); + coliVal = Double.parseDouble(coli.getValue()); + other1Val = other1.getValue(); + other2Val = other2.getValue(); + + nameOfInspector = name.getValue(); + nameOfSite = site.getValue(); + dateRow = date.getValue(); + outfall = String.valueOf(outfallValue.getValue()); + longitude = String.valueOf(longitudeValue.getValue()); + latitude = String.valueOf(latitudeValue.getValue()); + invertElevation = String.valueOf(invertElevationValue.getValue()); + + flowPres = convertToBoolean(flow.getValue()); + odorVal = odor.getValue(); + odorPres = convertToBoolean(odorVal); + colorVal = color.getValue(); + colorPres = convertToBoolean(colorVal); + polutantsVal = polutants.getValue(); + polutantsPres = convertToBoolean(polutantsVal); + obstructionVal = obstruction.getValue(); + obstructionPres = convertToBoolean(obstructionVal); + maintenanceVal = maintenance.getValue(); + needMaintenance = convertToBoolean(maintenanceVal); + screenVal = screen.getValue(); + screenOK = convertToBoolean(screenVal); + + //HQ value retrieval + subVal = pickerValue(subSize); + sub = subSize.getValue(); + smothVal = pickerValue(smothering); + smoth = smothering.getValue(); + siltVal = pickerValue(silting); + silt = silting.getValue(); + rootVal = pickerValue(rootwads); + rootString = rootwads.getValue(); + overVegVal = pickerValue(overhangingVeg); + overVeg = overhangingVeg.getValue(); + oxVal = pickerValue(oxbows); + streamVal = pickerValue(streamShading); + deepestVal = pickerValue(deepestPool); + velocityVal = pickerValue(velocityForm); + riffleDepthVal = pickerValue(riffleDepth); + riffleSubstrateVal = pickerValue(riffleSub); + ox = oxbows.getValue(); + downVal = pickerValue(downed); + down = downed.getValue(); + shallowVal = pickerValue(shallows); + shallow = shallows.getValue(); + watVal = pickerValue(waterPlants); + wat = waterPlants.getValue(); + deepVal = pickerValue(deepPools); + deep = deepPools.getValue(); + logVal = pickerValue(logs); + log = logs.getValue(); + bouldVal = pickerValue(boulders); + bould = boulders.getValue(); + underVal = pickerValue(undercutBanks); + under = undercutBanks.getValue(); + sinVal = pickerValue(sinuosity); + sin = sinuosity.getValue(); + natVal = pickerValue(natural); + nat = natural.getValue(); + ripVal = pickerValue(riparianWidth); + rip = riparianWidth.getValue(); + landVal = pickerValue(landUse); + land = landUse.getValue(); + bankVal = pickerValue(bankErosion); + bank = bankErosion.getValue(); + stream = streamShading.getValue(); + deepest = deepestPool.getValue(); + velocity = velocityForm.getValue(); + riffleDepthVar = riffleDepth.getValue(); + riffleSubstrateVar = riffleSub.getValue(); + //BM form retrieval + intolerantVal = Double.parseDouble(intolerant.getValue()); + modTolerantVal = Double.parseDouble(moderatelyTolerant.getValue()); + fairTolerantVal = Double.parseDouble(fairlyTolerant.getValue()); + veryTolerantVal = Double.parseDouble(veryTolerant.getValue()); + //Water Quality Index Data WaterWayDoubleFields.put("CT_E_coli",coliVal); - WaterWayDoubleFields.put("CT_temperature_change",tempVal ); + WaterWayDoubleFields.put("CT_temperature_change", tempVal); WaterWayDoubleFields.put("CT_turbidity", turbidityVal); WaterWayDoubleFields.put("CT_pH", phVal); WaterWayDoubleFields.put("CT_nitrate", nitrateVal); @@ -365,31 +456,24 @@ private void setupFormGen() { formItemsGen.add(title); FormElementTextSingleLine name = FormElementTextSingleLine.createInstance().setTitle("Name of Inspector").setValue(""); - nameOfInspector = name.getValue(); formItemsGen.add(name); FormElementTextSingleLine site = FormElementTextSingleLine.createInstance().setTitle("Name of site").setValue(""); - nameOfSite = site.getValue(); formItemsGen.add(site); FormElementPickerDate date = FormElementPickerDate.createInstance().setTitle("Date Row").setDateFormat("dd/MM/yyyy").setValue(""); - dateRow = date.getValue(); formItemsGen.add(date); FormElementTextSingleLine outfallValue = FormElementTextSingleLine.createInstance().setTitle("Outfall").setValue("0"); - outfall = String.valueOf(outfallValue.getValue()); formItemsGen.add(outfallValue); FormElementTextSingleLine longitudeValue = FormElementTextSingleLine.createInstance().setTitle("Longitude").setValue("0"); - longitude = String.valueOf(longitudeValue.getValue()); formItemsGen.add(longitudeValue); FormElementTextSingleLine latitudeValue = FormElementTextSingleLine.createInstance().setTitle("Latitude").setValue("0"); - latitude = String.valueOf(latitudeValue.getValue()); formItemsGen.add(latitudeValue); FormElementTextSingleLine invertElevationValue = FormElementTextSingleLine.createInstance().setTitle("Invert Elevation").setValue("0"); - invertElevation = String.valueOf(invertElevationValue.getValue()); formItemsGen.add(invertElevationValue); List pipeTypeOptions = new ArrayList(); @@ -573,55 +657,6 @@ private void setupFormHQ() { formItems.add(riffleDepth); formItems.add(riffleSub); fbHQ.addFormElements(formItems); - subVal = pickerValue(subSize); - sub = subSize.getValue(); - smothVal = pickerValue(smothering); - smoth = smothering.getValue(); - siltVal = pickerValue(silting); - silt = silting.getValue(); - rootVal = pickerValue(rootwads); - rootString = rootwads.getValue(); - overVegVal = pickerValue(overhangingVeg); - overVeg = overhangingVeg.getValue(); - oxVal = pickerValue(oxbows); - streamVal = pickerValue(streamShading); - deepestVal = pickerValue(deepestPool); - velocityVal = pickerValue(velocityForm); - riffleDepthVal = pickerValue(riffleDepth); - riffleSubstrateVal = pickerValue(riffleSub); - - ox = oxbows.getValue(); - downVal = pickerValue(downed); - down = downed.getValue(); - shallowVal = pickerValue(shallows); - shallow = shallows.getValue(); - watVal = pickerValue(waterPlants); - wat = waterPlants.getValue(); - deepVal = pickerValue(deepPools); - deep = deepPools.getValue(); - logVal = pickerValue(logs); - log = logs.getValue(); - bouldVal = pickerValue(boulders); - bould = boulders.getValue(); - underVal = pickerValue(undercutBanks); - under = undercutBanks.getValue(); - sinVal = pickerValue(sinuosity); - sin = sinuosity.getValue(); - natVal = pickerValue(natural); - nat = natural.getValue(); - ripVal = pickerValue(riparianWidth); - rip = riparianWidth.getValue(); - landVal = pickerValue(landUse); - land = landUse.getValue(); - bankVal = pickerValue(bankErosion); - bank = bankErosion.getValue(); - stream = streamShading.getValue(); - deepest = deepestPool.getValue(); - velocity = velocityForm.getValue(); - riffleDepthVar = riffleDepth.getValue(); - riffleSubstrateVar = riffleSub.getValue(); - - } @@ -646,31 +681,24 @@ private void setupFormDWS() { FormHeader title = (FormHeader) new FormHeader().setTitle("Dry Weather Screening"); FormElementSwitch flow = FormElementSwitch.createInstance().setTitle("Presence of Flow").setSwitchTexts("Yes", "No"); - flowPres = convertToBoolean(flow.getValue()); + FormElementSwitch odor = FormElementSwitch.createInstance().setTitle("Unusual Odor").setSwitchTexts("Yes", "No"); - odorVal = odor.getValue(); - odorPres = convertToBoolean(odorVal); + FormElementSwitch color = FormElementSwitch.createInstance().setTitle("Unusual Color").setSwitchTexts("Yes", "No"); - colorVal = color.getValue(); - colorPres = convertToBoolean(colorVal); + FormElementSwitch polutants = FormElementSwitch.createInstance().setTitle("Polutants Nearby").setSwitchTexts("Yes", "No"); - polutantsVal = polutants.getValue(); - polutantsPres = convertToBoolean(polutantsVal); + FormElementSwitch obstruction = FormElementSwitch.createInstance().setTitle("Obstruction").setSwitchTexts("Yes", "No"); - obstructionVal = obstruction.getValue(); - obstructionPres = convertToBoolean(obstructionVal); + FormElementSwitch maintenance = FormElementSwitch.createInstance().setTitle("Needs Maintenance").setSwitchTexts("Yes", "No"); - maintenanceVal = maintenance.getValue(); - needMaintenance = convertToBoolean(maintenanceVal); FormElementSwitch screen = FormElementSwitch.createInstance().setTitle("Screen OK").setSwitchTexts("Yes", "No"); - screenVal = screen.getValue(); - screenOK = convertToBoolean(screenVal); + formItemsDWS = new ArrayList<>(); @@ -693,31 +721,24 @@ private void setupFormCT() { FormHeader title = (FormHeader) new FormHeader().setTitle("Chemical Testing"); FormElementTextNumber temperature = new FormElementTextNumber().createInstance().setTitle("Temperature (C) Change").setValue("0"); - tempVal = Double.parseDouble(temperature.getValue()); FormElementTextNumber tubidity = new FormElementTextNumber().createInstance().setTitle("Tubidity (NTU)").setValue("0"); - turbidityVal = Double.parseDouble(tubidity.getValue()); FormElementTextNumber pH = new FormElementTextNumber().createInstance().setTitle("pH").setValue("0"); - phVal = Double.parseDouble(pH.getValue()); FormElementTextNumber nitrate = new FormElementTextNumber().createInstance().setTitle("Nitrate (mg/L)").setValue("0"); - nitrateVal = Double.parseDouble(nitrate.getValue()); FormElementTextNumber phosphate = new FormElementTextNumber().createInstance().setTitle("Total Phosphate (mg/L)").setValue("0"); - phosphateVal = Double.parseDouble(phosphate.getValue()); FormElementTextNumber oxygen = new FormElementTextNumber().createInstance().setTitle("Dissolved Oxygen (mg/L)").setValue("0"); - oxygenVal = Double.parseDouble(oxygen.getValue()); FormElementTextNumber coli = new FormElementTextNumber().createInstance().setTitle("E Coli (col/100mL)").setValue("0"); - coliVal = Double.parseDouble(coli.getValue()); + FormElementTextSingleLine other1 = new FormElementTextSingleLine().createInstance().setTitle("Other 1").setValue(""); - other1Val = other1.getValue(); + FormElementTextSingleLine other2 = new FormElementTextSingleLine().createInstance().setTitle("Other 2").setValue(""); - other2Val = other2.getValue(); formItemsCT = new ArrayList<>();