noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 118/323: Progress Bar : use GET , which is fa


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 118/323: Progress Bar : use GET , which is faster than POST, use 2 decimal in progress because if the step is < 1 , it doesn't work
Date: Wed, 14 Mar 2018 17:38:35 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 40cbb89f93882049aa6f2732d66d90038599a218
Author: Dany De Bontridder <address@hidden>
Date:   Sat Feb 3 16:18:02 2018 +0100

    Progress Bar : use GET , which is faster than  POST, use 2 decimal in 
progress because if the step is < 1 , it doesn't work
---
 html/js/scripts.js                      | 1 +
 include/class/document_export.class.php | 6 ++++--
 include/lib/progress_bar.class.php      | 1 +
 sql/upgrade.sql                         | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/html/js/scripts.js b/html/js/scripts.js
index 6595ca9..614fdf0 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -3438,6 +3438,7 @@ function progress_bar_check(p_idx, p_taskid)
 
         new Ajax.Request("ajax_misc.php", {
             parameters: {gDossier: 0, task_id: p_taskid,op:"progressBar"},
+            method:"get",
             onSuccess: function (req) {
                 try 
                 {
diff --git a/include/class/document_export.class.php 
b/include/class/document_export.class.php
index ac632dd..fea8edc 100644
--- a/include/class/document_export.class.php
+++ b/include/class/document_export.class.php
@@ -127,7 +127,7 @@ class Document_Export
         $cnt_feedback=0;
         global $cn;
         // follow progress
-        $step=round(20/count($p_array));
+        $step=round(16/count($p_array),2);
         
         $cn->start();
         foreach ($p_array as $value)
@@ -244,6 +244,7 @@ class Document_Export
             // concatenate detail operation with the output
             $stmt = PDFTK . " " . $detail_operation->get_pdf_filename()." 
".$output. 
                     ' output ' . $output2;
+            
             $progress->increment($step);
             passthru($stmt, $status);
             if ($status <> 0)
@@ -264,15 +265,16 @@ class Document_Export
             // Move the PDF into another temp directory 
             $this->move_file($output, 'stamp_' . $file_pdf);
         }
+        
         $progress->set_value(93);
         // concatenate all pdf into one
         $this->concatenate_pdf();
         
-        $progress->set_value(100);
         
         ob_clean();
         $this->send_pdf();
 
+        $progress->set_value(100);
         // remove files from "conversion folder"
         $this->clean_folder();
         
diff --git a/include/lib/progress_bar.class.php 
b/include/lib/progress_bar.class.php
index 50b1d08..f459fc1 100644
--- a/include/lib/progress_bar.class.php
+++ b/include/lib/progress_bar.class.php
@@ -67,6 +67,7 @@ class Progress_Bar
             $this->value=0;
             $this->db->exec_sql("insert into progress(p_id,p_value) values 
($1,0)",
                     [$p_task_id]);
+            $this->db->exec_sql("delete from progress where p_created < now() 
- interval '3 hours' ");
         }
     }
     /**
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 21af50a..1b7e8d8 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -13,7 +13,7 @@ alter table jnt_use_dos add CONSTRAINT use_id_dos_id_uniq 
UNIQUE (use_id,dos_id)
 create table progress 
 (
     p_id varchar(16) primary key,
-    p_value integer not null ,
+    p_value numeric (5,2) not null ,
     p_created timestamp default now()
 );
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]