[Fusionforge-commits] FusionForge branch master updated. cd7c90249766918d48fba4e1b4709752a7425c65
Alain Peyrat
aljeux at fusionforge.org
Thu May 23 12:00:05 CEST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, master has been updated
via cd7c90249766918d48fba4e1b4709752a7425c65 (commit)
from 4e5c09a822863d7ca219d2cda5d5e99c7b3800e6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cd7c90249766918d48fba4e1b4709752a7425c65
Author: Alain Peyrat <alain.peyrat at alcatel-lucent.com>
Date: Thu May 23 11:59:41 2013 +0200
Fix Tracker open number does not reflect the real number if tracker was created by closed directly
diff --git a/src/db/20130523-fix_tracker_open_count.sql b/src/db/20130523-fix_tracker_open_count.sql
new file mode 100644
index 0000000..ae72f3e
--- /dev/null
+++ b/src/db/20130523-fix_tracker_open_count.sql
@@ -0,0 +1,22 @@
+-- Fix count first
+
+UPDATE artifact_counts_agg
+SET count=subquery.count,
+ open_count=subquery.open_count
+FROM (SELECT group_artifact_id, COUNT(group_artifact_id) AS count,
+ SUM(CASE WHEN status_id=1 THEN 1 ELSE 0 END) AS open_count
+ FROM artifact
+ GROUP BY group_artifact_id) AS subquery
+WHERE artifact_counts_agg.group_artifact_id=subquery.group_artifact_id;
+
+-- Fix insert rule (only increase open count if open)
+
+DROP RULE artifact_insert_agg ON artifact;
+
+CREATE OR REPLACE RULE artifact_insert_agg AS
+ON INSERT TO artifact DO UPDATE artifact_counts_agg SET count = artifact_counts_agg.count + 1, open_count =
+ CASE
+ WHEN new.status_id = 1 THEN artifact_counts_agg.open_count + 1
+ ELSE artifact_counts_agg.open_count
+ END
+WHERE artifact_counts_agg.group_artifact_id = new.group_artifact_id;
-----------------------------------------------------------------------
Summary of changes:
src/db/20130523-fix_tracker_open_count.sql | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 src/db/20130523-fix_tracker_open_count.sql
hooks/post-receive
--
FusionForge
More information about the Fusionforge-commits
mailing list