[232682] Emtpy files should have a status of 100%
diff --git a/babel-setup.sql b/babel-setup.sql
index b3e1bf4..ac8c757 100644
--- a/babel-setup.sql
+++ b/babel-setup.sql
@@ -428,6 +428,7 @@
insert into map_files values ("eclipse", "3.4", "userassist.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/userassist.map?view=co", 1);
/* populate file_progress table */
+/* See also: dbmaintenance_15min.php */
truncate table file_progress;
INSERT INTO file_progress
select f.file_id, l.language_id, IF(COUNT(s.string_id) > 0, COUNT(t.string_id)/COUNT(s.string_id)*100,100) AS translate_percent
diff --git a/classes/export/dbmaintenance_15min.php b/classes/export/dbmaintenance_15min.php
index fa55a84..b803e3f 100644
--- a/classes/export/dbmaintenance_15min.php
+++ b/classes/export/dbmaintenance_15min.php
@@ -32,11 +32,30 @@
$dbh = $dbc->connect();
- # refresh the scoreboard -- not every 15 minutes
+ # refresh the scoreboard -- not every 15 minutes!
if(rand(1, 100) < 6) {
require_once(BABEL_BASE_DIR . "classes/system/scoreboard.class.php");
$sb = new Scoreboard();
$sb->refresh();
+
+ # Refresh file progress
+ # This only needs to happen once in a while too.
+ # See also: babel-setup.sql
+ mysql_query("DELETE FROM file_progress", $dbh);
+ mysql_query("
+INSERT INTO file_progress
+select f.file_id, l.language_id, IF(COUNT(s.string_id) > 0, COUNT(t.string_id)/COUNT(s.string_id)*100,100) AS translate_percent
+FROM files AS f
+ INNER JOIN languages as l ON l.is_active = 1
+ LEFT JOIN strings as s ON (s.file_id = f.file_id AND s.is_active)
+ LEFT JOIN translations AS t ON (s.string_id = t.string_id
+ AND t.language_id = l.language_id AND t.is_active = 1)
+WHERE f.is_active = 1
+ AND s.value <> ''
+GROUP BY f.file_id, l.language_id", $dbh);
+ mysql_query("DELETE FROM file_progress WHERE pct_complete = 0", $dbh);
+
+
}
# Update project/version/language progress