评分修改迁移文件

This commit is contained in:
nieguanghui 2014-04-10 16:40:29 +08:00
parent d554bf1ea9
commit b334c02244
1 changed files with 10 additions and 25 deletions

View File

@ -94,26 +94,16 @@ BEGIN
DECLARE cur_project CURSOR FOR
SELECT
project_id,
COUNT(*)
FROM (SELECT
project_id,
repositories.id
FROM repositories
INNER JOIN changesets
WHERE repositories.id = changesets.repository_id
AND project_id IN (SELECT
projects.id
FROM projects
WHERE (((projects.status <> 9)
AND (projects.is_public = 1))))) t
GROUP BY project_id;
WHERE projects.status <> 9
AND projects.is_public = 1 ;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1;
OPEN cur_project;
loop_xxx:
LOOP
FETCH cur_project INTO project_uid, project_changesets_count;
FETCH cur_project INTO project_uid;
IF _done = 1 THEN
LEAVE loop_xxx;
END IF;
@ -315,17 +305,12 @@ LOOP
SUM(boards.messages_count) INTO boards_messages_count
FROM boards
WHERE project_id = project_uid;
IF boards_messages_count IS NULL THEN
SET boards_messages_count = 0;
SET total_count = issues_count * 0.2 +
issues_jour_count_total * 0.1 +
news_count * 0.1 +
news_jour_count_total * 0.1 +
documents_count * 0.1 +
project_changesets_count * 0.3 +
boards_messages_count * 0.1;
ELSE
SELECT
COUNT(*) INTO project_changesets_count
FROM `changesets`
INNER JOIN `repositories` ON `changesets`.`repository_id` = `repositories`.`id`
WHERE `repositories`.`project_id` = project_uid AND (is_default = 1);
SET total_count = issues_count * 0.2 +
issues_jour_count_total * 0.1 +
news_count * 0.1 +
@ -333,7 +318,7 @@ LOOP
documents_count * 0.1 +
project_changesets_count * 0.3 +
boards_messages_count * 0.1;
END IF;
IF total_count IS NOT NULL THEN