AguaClara / AguaClara.github.io

The website used to demonstrate the visualizations application to the public and engineers.
MIT License
0 stars 0 forks source link

Give users the ability to chose a timespan for the desired plant data #20

Open danelimjoco opened 7 years ago

danelimjoco commented 7 years ago

Hi @ethan92429!

Just wanted to give you an update of my overall task at the moment. I'm trying to give users the ability to choose what data is displayed on the website by either choosing day, week, month, or year which will result in different queries when the function updatePlantData is called. To do this, I've added some buttons but I'm having trouble getting the functionality to work properly.

I was wondering if you could explain this chunk of code to me. It's in index.html. Right now, my main issue is that I need to pass codeList as a parameter into updatePlantData, but I can't figure out how to do that since it's defined in the block of code I pasted below. I'm thinking either that is the issue, or that you can't just call updatePlantData and expect it to update. Any help would be appreciated, thanks!

*Since this is a pretty complex problem, I'd be open for a call to work through it if you have time! I'll be in the AguaClara lab starting at 4:30 today

$(document).ready(function() {
        submitRadioValues = function(){
          plantCode = $('input[name="plantSelection"]:checked').val();
          save("plantName", plantCode);
          $("#allPlantsDropDown").html("");
          connectSyncButton();
          codeList = [plantCode];
          initViz(codeList);
          $("#datosHeader").html("Datos Sobre la Planta de "+plantCode);
          $("#syncButtonDiv").html("<a id='sync-viz' class='waves-effect waves-light btn'>Sincronizar</a>");
          connectSyncButton();
          addSpinner('#spinnerDestination');
          updatePlantData(visualize, codeList, "month");
          $("#selectPrompt").html("");
        }

        if (getPlantName()==null){
          window.location.replace("/settings.html");

        }else{
          $("#selectPrompt").html("");
          $("#syncButtonDiv").html("<a id='sync-viz' class='waves-effect waves-light btn'>Sincronizar</a>");
          var codeList = [getPlantName()]; //list of currently chosen plants (by code)
          connectSyncButton();
          initViz(codeList);
          addSpinner('#spinnerDestination');
          updatePlantData(visualize, codeList, "month");
        }
      });
eak24 commented 7 years ago

@danelimjoco I'm not sure why you want to include the codelist in as a parameter? I defined the spec for the updatePlantData function here. It is used incorrectly in the index page and we can see that when calling it from the master page. It's supposed to just take an onSuccess and onFailure callback method. That's definitely an error in the index page logic. That index page is pretty screwed up. I'll be there this week and we can work on it together!

danelimjoco commented 7 years ago

@ethan92429 Ok sounds good I'll see you tomorrow!