3 * Copyright 1999-2001 (c) VA Linux Systems
5 * This file is part of FusionForge. FusionForge is free software;
6 * you can redistribute it and/or modify it under the terms of the
7 * GNU General Public License as published by the Free Software
8 * Foundation; either version 2 of the Licence, or (at your option)
11 * FusionForge is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 // POPULATES stats_project table - included in site_stats.php
27 function project_stats_day($year,$month,$day) {
30 $day_begin=mktime(0,0,0,$month,$day,$year);
31 $day_end=($day_begin + 86400);
33 # echo "Stats_project: $datetime::$day_begin::$day_end::".date('Ymd',$day_begin)."::".date('Ymd',$day_end)."--> $i\n";
35 db_query_params ('DELETE FROM stats_project WHERE month=$1 AND day=$2',
39 db_query_params ('INSERT INTO stats_project
46 r.count AS release_count,
47 fmcount.count AS msg_posted,
48 fucount.count AS msg_uniq_auth,
49 obug.count AS bugs_opened,
50 cbug.count AS bugs_closed,
51 osupport.count AS support_opened,
52 csupport.count AS support_closed,
53 opatches.count AS patches_opened,
54 cpatches.count AS patches_closed,
55 oartifact.count AS artifacts_opened,
56 cartifact.count AS artifacts_closed,
57 otask.count AS tasks_opened,
58 ctask.count AS tasks_closed,
59 helpr.count AS help_requests
64 -- Create tmp table of groups that made any releases
67 SELECT group_id,COUNT(release_id) AS count
68 FROM frs_release,frs_package
70 frs_release.release_date > $3
71 AND frs_release.release_date < $4
72 AND frs_release.package_id = frs_package.package_id
77 -- Create tmp table of groups that had any forum posts
80 SELECT forum_group_list.group_id,COUNT(forum.msg_id) AS count
81 FROM forum_group_list, forum
83 forum_group_list.group_forum_id = forum.group_forum_id
84 AND forum.post_date > $3
85 AND forum.post_date < $4
86 GROUP BY forum_group_list.group_id
87 ) fmcount USING (group_id)
90 -- Create tmp table of groups and unique posters to forums
93 SELECT forum_group_list.group_id,COUNT( DISTINCT(forum.posted_by) ) AS count
94 FROM forum_group_list, forum
96 forum_group_list.group_forum_id = forum.group_forum_id
97 AND forum.post_date > $3
98 AND forum.post_date < $4
100 ) fucount USING (group_id)
103 -- Create tmp table of groups and opened bugs
106 SELECT agl.group_id,count(*) AS count
107 FROM artifact_group_list agl,artifact a
111 AND a.group_artifact_id=agl.group_artifact_id
113 GROUP BY agl.group_id
114 ) obug USING (group_id)
117 -- Create tmp table of groups and closed bugs
120 SELECT agl.group_id,count(*) AS count
121 FROM artifact_group_list agl,artifact a
124 AND a.close_date < $4
125 AND a.group_artifact_id=agl.group_artifact_id
127 GROUP BY agl.group_id
128 ) cbug USING (group_id)
131 -- Create tmp table of groups and opened support
134 SELECT agl.group_id,count(*) AS count
135 FROM artifact_group_list agl,artifact a
139 AND a.group_artifact_id=agl.group_artifact_id
141 GROUP BY agl.group_id
142 ) osupport USING (group_id)
145 -- Create tmp table of groups and closed support
148 SELECT agl.group_id,count(*) AS count
149 FROM artifact_group_list agl,artifact a
152 AND a.close_date < $4
153 AND a.group_artifact_id=agl.group_artifact_id
155 GROUP BY agl.group_id
156 ) csupport USING (group_id)
159 -- Create tmp table of groups and opened patches
162 SELECT agl.group_id,count(*) AS count
163 FROM artifact_group_list agl,artifact a
167 AND a.group_artifact_id=agl.group_artifact_id
169 GROUP BY agl.group_id
170 ) opatches USING (group_id)
173 -- Create tmp table of groups and closed patches
176 SELECT agl.group_id,count(*) AS count
177 FROM artifact_group_list agl,artifact a
180 AND a.close_date < $4
181 AND a.group_artifact_id=agl.group_artifact_id
183 GROUP BY agl.group_id
184 ) cpatches USING (group_id)
187 -- Create tmp table of groups and opened total artifacts
190 SELECT agl.group_id,count(*) AS count
191 FROM artifact_group_list agl,artifact a
195 AND a.group_artifact_id=agl.group_artifact_id
196 GROUP BY agl.group_id
197 ) oartifact USING (group_id)
200 -- Create tmp table of groups and closed total artifacts
203 SELECT agl.group_id,count(*) AS count
204 FROM artifact_group_list agl,artifact a
207 AND a.close_date < $4
208 AND a.group_artifact_id=agl.group_artifact_id
209 GROUP BY agl.group_id
210 ) cartifact USING (group_id)
213 -- Create tmp table of groups that opened tasks
216 SELECT pgl.group_id,count(pt.project_task_id) AS count
217 FROM project_group_list pgl, project_task pt
219 pgl.group_project_id=pt.group_project_id
220 AND pt.start_date > $3
221 AND pt.start_date < $4
222 GROUP BY pgl.group_id
223 ) otask USING (group_id)
226 -- Create tmp table of groups that closed tasks
229 SELECT pgl.group_id,count(pt.project_task_id) AS count
230 FROM project_group_list pgl, project_task pt
232 pgl.group_project_id=pt.group_project_id
235 GROUP BY pgl.group_id
236 ) ctask USING (group_id)
239 -- Create tmp table of groups that closed tasks
242 SELECT group_id,COUNT(job_id) AS count
248 ) helpr USING (group_id)
253 -- We really only want the rows that have any content
261 OR support_opened > 0
262 OR support_closed > 0
263 OR patches_opened > 0
264 OR patches_closed > 0
265 OR artifacts_opened > 0
266 OR artifacts_closed > 0
269 OR help_requests > 0;',
288 // c-file-style: "bsd"