修复项目列表分数显示不一致的问题,修改用户列表显示不一致的问题,修改作业中项目显示分数和项目内部分数不一致的问题

This commit is contained in:
nieguanghui 2014-04-11 10:53:51 +08:00
parent 1c69e80745
commit 6baa87a8ea
7 changed files with 20 additions and 15 deletions

View File

@ -82,6 +82,7 @@ class User < Principal
#####fq
has_many :jours, :class_name => 'JournalsForMessage', :dependent => :destroy
has_many :journals_messages, :class_name => 'JournalsForMessage', :foreign_key => "user_id", :dependent => :destroy
has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1"

View File

@ -78,7 +78,7 @@
<% user_changesets_score = user_changesets_count * 0.3 %>
<% finall_user_project_score = journals_score + user_changesets_score %>
<% journals_for_messages_count = @user.journals_for_messages.count %>
<% journals_for_messages_count = @user.journals_messages.count %>
<% activities_count = @user.activities.count %>
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
<% activities_score = activities_count * 0.2 %>

View File

@ -1,10 +1,10 @@
<!-- added by bai -->
<% journals_for_messages_count = @user.journals_for_messages.count %>
<% journals_for_messages_count = @user.journals_messages.count %>
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
<% activities_count = @user.activities.count %>
<% activities_score = activities_count * 0.2 %>
<% finall_activity_score = journals_for_messages_score + activities_score %>
<div><%= l(:label_message_number) %> * 0.05 = <%= @user.journals_for_messages.count %> * 0.05 = <%= format("%.2f" , journals_for_messages_score).to_f %></div>
<div><%= l(:label_message_number) %> * 0.05 = <%= @user.journals_messages.count %> * 0.05 = <%= format("%.2f" , journals_for_messages_score).to_f %></div>
<div><%= l(:label_activity_number) %> * 0.2 = <%= @user.activities.count %> * 0.2 = <%= format("%.2f" , activities_score).to_f %></div>
<div><%= l(:label_user_score_of_activity) %> = <%= format("%.2f" , journals_for_messages_score).to_f %> + <%= format("%.2f" , activities_score).to_f %>
= <%= format("%.2f" , finall_activity_score).to_f %></div>

View File

@ -9,7 +9,7 @@
<% user_changesets_score = user_changesets_count * 0.3 %>
<% finall_user_project_score = journals_score + user_changesets_score %>
<% journals_for_messages_count = @user.journals_for_messages.count %>
<% journals_for_messages_count = @user.journals_messages.count %>
<% activities_count = @user.activities.count %>
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
<% activities_score = activities_count * 0.2 %>

View File

@ -11,7 +11,7 @@
<% user_changesets_score = user_changesets_count * 0.3 %>
<% finall_user_project_score = journals_score + user_changesets_score %>
<% journals_for_messages_count = @user.journals_for_messages.count %>
<% journals_for_messages_count = @user.journals_messages.count %>
<% activities_count = @user.activities.count %>
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
<% activities_score = activities_count * 0.2 %>

View File

@ -13,7 +13,7 @@
<% user_changesets_score = user_changesets_count * 0.3 %>
<% finall_user_project_score = journals_score + user_changesets_score %>
<% journals_for_messages_count = user.journals_for_messages.count %>
<% journals_for_messages_count = user.journals_messages.count %>
<% activities_count = user.activities.count %>
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
<% activities_score = activities_count * 0.2 %>

View File

@ -8,17 +8,15 @@ BEGIN
DECLARE user_changesets_count int(10);
DECLARE _done tinyint(1) DEFAULT 0;
DECLARE cur_user CURSOR FOR
SELECT
user_id,
COUNT(*)
FROM changesets
WHERE user_id != ''
GROUP BY user_id;
SELECT
users.id
FROM users
WHERE users.type = 'User' AND users.status = 1 AND users.admin = 0;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1;
OPEN cur_user;
loop_xxx:
LOOP
FETCH cur_user INTO user_uid, user_changesets_count;
FETCH cur_user INTO user_uid ;
IF _done = 1 THEN
LEAVE loop_xxx;
END IF;
@ -35,7 +33,7 @@ LOOP
SELECT
COUNT(*) INTO journals_for_messages_count
FROM journals_for_messages
WHERE user_id = user_uid;
WHERE user_id = user_uid ;
SELECT
COUNT(*) INTO journals_count
FROM journals
@ -60,6 +58,12 @@ LOOP
COUNT(*) INTO activities_count
FROM activities
WHERE user_id = user_uid;
SELECT
COUNT(*) INTO user_changesets_count
FROM changesets
WHERE changesets.user_id = user_uid;
SET total_count = journals_for_messages_count * 0.05 +
journals_count * 0.1 +
@ -97,7 +101,7 @@ BEGIN
projects.id
FROM projects
WHERE projects.status <> 9
AND projects.is_public = 1 ;
AND projects.is_public = 1 AND projects.project_type = 0 ;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1;
OPEN cur_project;