[evolvis-commits] r7119: merge bm:taramir/patches/ new-values-for-pm-sta =?UTF-8?Q?tus=2Dfield=E2=86=B5=20=2A=20?=[#1112] Treat Copy+Closed as closed existing tasks↵ Thorsten Glaser 2010-12-20 with hel =?UTF-8?Q?p=20from=20Alexander=20Stee?==?UTF-8?Q?g?=, provide SQL upgrade code↵ Thorsten Glaser 2010-12-15 par =?UTF-8?Q?t=201=20of=202=20for=20?=[#1112] incorrect task count in subproject overvi?==?UTF-8?Q?ew↵
mirabilos at evolvis.org
mirabilos at evolvis.org
Mon Dec 20 16:17:24 CET 2010
Author: mirabilos
Date: 2010-12-20 16:17:24 +0100 (Mon, 20 Dec 2010)
New Revision: 7119
Modified:
trunk/gforge_base/evolvisforge/gforge/deb-specific/db-upgrade.pl
trunk/gforge_base/evolvisforge/gforge/debian/changelog
Log:
merge bm:taramir/patches/new-values-for-pm-status-field
* [#1112] Treat Copy+Closed as closed existing tasks
Thorsten Glaser 2010-12-20 with help from Alexander Steeg, provide SQL upgrade code
Thorsten Glaser 2010-12-15 part 1 of 2 for [#1112] incorrect task count in subproject overview
Modified: trunk/gforge_base/evolvisforge/gforge/deb-specific/db-upgrade.pl
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/deb-specific/db-upgrade.pl 2010-12-17 15:52:31 UTC (rev 7118)
+++ trunk/gforge_base/evolvisforge/gforge/deb-specific/db-upgrade.pl 2010-12-20 15:17:24 UTC (rev 7119)
@@ -3299,6 +3299,130 @@
$dbh->commit () ;
}
+ $version = &get_db_version ;
+ $target = "4.8.3+evolvis26.5" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Fix projectgroup aggregates for Copy+Closed status") ;
+ @reqlist = (
+ q{
+CREATE OR REPLACE FUNCTION projectgroup_update_agg() RETURNS trigger
+ AS $$
+ BEGIN
+ -- PATCHED FOR EVOLVIS
+ --
+ -- see if they are moving to a new subproject
+ -- if so, its a more complex operation
+ --
+ -- also supports status 7 (Copy+Closed) as closed
+ --
+ IF NEW.group_project_id <> OLD.group_project_id THEN
+ --
+ -- transferred tasks always have a status of 1
+ -- so we will increment the new subprojects sums
+ --
+ IF OLD.status_id=3 THEN
+ -- No need to decrement counters on old tracker
+ ELSE
+ IF OLD.status_id IN (2,7) THEN
+ UPDATE project_counts_agg SET count=count-1
+ WHERE group_project_id=OLD.group_project_id;
+ ELSE
+ IF OLD.status_id IN (1,4,5,6) THEN
+ UPDATE project_counts_agg SET count=count-1,open_count=open_count-1
+ WHERE group_project_id=OLD.group_project_id;
+ END IF;
+ END IF;
+ END IF;
+
+ IF NEW.status_id=3 THEN
+ --DO NOTHING
+ ELSE
+ IF NEW.status_id IN (2,7) THEN
+ UPDATE project_counts_agg SET count=count+1
+ WHERE group_project_id=NEW.group_project_id;
+ ELSE
+ IF NEW.status_id IN (1,4,5,6) THEN
+ UPDATE project_counts_agg SET count=count+1, open_count=open_count+1
+ WHERE group_project_id=NEW.group_project_id;
+ END IF;
+ END IF;
+ END IF;
+ ELSE
+ --
+ -- just need to evaluate the status flag and
+ -- increment/decrement the counter as necessary
+ --
+ IF NEW.status_id <> OLD.status_id THEN
+ IF NEW.status_id IN (1,4,5,6) THEN
+ IF OLD.status_id IN (2,7) THEN
+ UPDATE project_counts_agg SET open_count=open_count+1
+ WHERE group_project_id=NEW.group_project_id;
+ ELSE
+ IF OLD.status_id=3 THEN
+ UPDATE project_counts_agg SET open_count=open_count+1, count=count+1
+ WHERE group_project_id=NEW.group_project_id;
+ END IF;
+ END IF;
+ ELSE
+ IF NEW.status_id IN (2,7) THEN
+ IF OLD.status_id IN (1,4,5,6) THEN
+ UPDATE project_counts_agg SET open_count=open_count-1
+ WHERE group_project_id=NEW.group_project_id;
+ ELSE
+ IF OLD.status_id=3 THEN
+ UPDATE project_counts_agg SET count=count+1
+ WHERE group_project_id=NEW.group_project_id;
+ END IF;
+ END IF;
+ ELSE
+ IF NEW.status_id = 3 THEN
+ IF OLD.status_id IN (2,7) THEN
+ UPDATE project_counts_agg SET count=count-1
+ WHERE group_project_id=NEW.group_project_id;
+ ELSE
+ IF OLD.status_id IN (1,4,5,6) THEN
+ UPDATE project_counts_agg SET open_count=open_count-1,count=count-1
+ WHERE group_project_id=NEW.group_project_id;
+ END IF;
+ END IF;
+ END IF;
+ END IF;
+ END IF;
+ END IF;
+ END IF;
+ RETURN NEW;
+END;
+$$
+ LANGUAGE plpgsql;
+},
+ "DELETE FROM project_counts_agg;",
+ "INSERT INTO project_counts_agg
+ SELECT group_project_id,
+ (SELECT COUNT(*) FROM project_task
+ WHERE project_task.group_project_id = project_group_list.group_project_id
+ AND status_id IN (1,2,4,5,6,7)
+ ),
+ (SELECT COUNT(*) FROM project_task
+ WHERE project_task.group_project_id = project_group_list.group_project_id
+ AND status_id IN (1,4,5,6)
+ )
+ FROM project_group_list;",
+ ) ;
+
+ foreach my $s (@reqlist) {
+ $query = $s ;
+ # debug $query ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+ }
+ @reqlist = () ;
+
+ &update_db_version ($target) ;
+ &debug ("Committing.") ;
+ $dbh->commit () ;
+ }
+
########################### INSERT HERE #################################
&debug ("It seems your database $action went well and smoothly. That's cool.") ;
Modified: trunk/gforge_base/evolvisforge/gforge/debian/changelog
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/debian/changelog 2010-12-17 15:52:31 UTC (rev 7118)
+++ trunk/gforge_base/evolvisforge/gforge/debian/changelog 2010-12-20 15:17:24 UTC (rev 7119)
@@ -45,6 +45,7 @@
list by default, in case mailman-ssls is installed where archives
are disabled globally.
* Correct or workaround lintian warnings, update debconf translations.
+ * [#1112] Treat Copy+Closed as closed existing tasks.
[ Patrick Apel ]
* When sending out Tasks mails, issue permalinks [#1047].
@@ -52,7 +53,7 @@
* Bugfix [#1018] Status in Tasks falsch.
* [#1019] Cumulate Tasks estimated hours, display in overview.
- -- Thorsten Glaser <t.glaser at tarent.de> Fri, 17 Dec 2010 16:51:54 +0100
+ -- Thorsten Glaser <t.glaser at tarent.de> Mon, 20 Dec 2010 13:54:45 +0100
gforge (4.8.3+evolvis26.4) unstable; urgency=high
More information about the evolvis-commits
mailing list