/corrections?importid= broken

Issue #14 resolved
Paul Stasiuk repo owner created an issue

http://127.0.0.1:8000/corrections/?importid=146 is broken. URL doesn't exist?

Comments (4)

  1. Paul Stasiuk reporter

    Making the changes in this method:

    function getStatus(importid,update_div){
      url=api_server_address+"import/status/?importid=" + importid;
      //$(update_div).append("<p><h4> Retriving " + importid + " status.</h4></p>");
    
      $.getJSON(url,function(data,importid){
        //console.log(data);
        var $bar = $('.bar');
        var p1 = "";
        //$(update_div).append("<p><h4> Retriving " + data + " status.</h4></p>");
        if (data.completed == "True"){
          p1 = "<b> Your data upload has been completed. Please click <a href='/corrections?importid='"+importid+"'> here </a>"+
          "to make corrections.</b><br />";
        }if (!data.started){
          p1 = "<b> Your data is in the queue to be processed. Please check back at a later time.</b><br/>";
        }
    
        if (data.dateend == "None"){
          data.dateend = "";
        }if(data.datestarted == "None"){
          data.datestarted = "";
        }
    
        var p2 = "<b>Number of data rows: </b>" + data.total_data_rows + "<br/>" +
                 "<b>Date analysis started: </b>" + data.datestarted + "<br/>" +
                 //"<b>Date analysis ended: </b>" + data.dateend + "<br/>"+
                 "<b>Filename: </b>" + data.filename +"</br>";
    
    
        //var percent_done = (data.number_of_rows_analyised/data.total_data_rows) * 100;
        $bar.width(0);
    
        $(update_div).append(p1);
        $(update_div).append(p2);
    
      });
    
        var progress = setInterval(function(importid,update_div){
          var $bar = $('.bar');
          $.getJSON(url,function(data,importid,update_div){
            //console.log(data);
            var percent_done = Math.floor((data.number_of_rows_analyised/data.total_data_rows) * 400);
            $bar.width(percent_done);
            $bar.text(percent_done/4 + "%");
    
            if ($bar.width()/4 == 100){
              if (data.completed == "True"){
                p1 = "<b> Your data upload has been completed. Please click <a href='/corrections?importid='"+importid+"'> here </a>"+
                "to make corrections.</b><br />";
                clearInterval(progress);
                $('.progress').removeClass('active');
                $(update_div).append(p1);
              }else{
                $bar.text("Running EPA Queries");
              }
              if (data.dateend == "None"){
                data.dateend = "";
              }else{
                $(update_div).append("<b>Date analysis ended: </b>"+data.dateend);
              }
    
            }
          });
        },2000);
    
    /*
    <div class="progress progress-striped active">
      <div class="bar" style="width: 40%;"></div>
    </div>
    */
    
    }
    
  2. Paul Stasiuk reporter

    Updated d3examples.js function:

    function getStatus(importid,update_div){
      url=api_server_address+"import/status/?importid=" + importid;
      //$(update_div).append("<p><h4> Retriving " + importid + " status.</h4></p>");
      console.log(importid);
      $.getJSON(url,function(data,importid){
        //console.log(data);
        importid = data.importid
        var $bar = $('.bar');
        var p1 = "";
        //$(update_div).append("<p><h4> Retriving " + data + " status.</h4></p>");
        if (data.completed == "True"){
          p1 = "<b> Your data upload has been completed. Please click <a href=/corrections/correct/?importid="+importid+"> here </a>"+
                "to make corrections.</b><br />";
        }if (!data.started){
          p1 = "<b> Your data is in the queue to be processed. Please check back at a later time.</b><br/>";
        }
    
        if (data.dateend == "None"){
          data.dateend = "";
        }if(data.datestarted == "None"){
          data.datestarted = "";
        }
    
        var p2 = "<b>Number of data rows: </b>" + data.total_data_rows + "<br/>" +
                 "<b>Date analysis started: </b>" + data.datestarted + "<br/>" +
                 //"<b>Date analysis ended: </b>" + data.dateend + "<br/>"+
                 "<b>Filename: </b>" + data.filename +"</br>";
    
    
        //var percent_done = (data.number_of_rows_analyised/data.total_data_rows) * 100;
        $bar.width(0);
    
        $(update_div).append(p1);
        $(update_div).append(p2);
    
      });
    
        var progress = setInterval(function(importid,update_div){
          var $bar = $('.bar');
          $.getJSON(url,function(data,importid,update_div){
            //console.log(data);
            var percent_done = Math.floor((data.number_of_rows_analyised/data.total_data_rows) * 400);
            $bar.width(percent_done);
            $bar.text(percent_done/4 + "%");
    
            if ($bar.width()/4 == 100){
              if (data.completed == "True"){
                p1 = "<b> Your data upload has been completed. Please click <a href=/corrections/correct/?importid="+importid+"> here </a>"+
                "to make corrections.</b><br />";
                clearInterval(progress);
                $('.progress').removeClass('active');
                $(update_div).append(p1);
              }else{
                $bar.text("Running EPA Queries");
              }
              if (data.dateend == "None"){
                data.dateend = "";
              }else{
                $(update_div).append("<b>Date analysis ended: </b>"+data.dateend);
              }
    
            }
          });
        },2000);
    
    /*
    <div class="progress progress-striped active">
      <div class="bar" style="width: 40%;"></div>
    </div>
    */
    
    }
    
  3. Log in to comment