评分修改迁移文件

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