This commit is contained in:
sw 2014-06-19 15:56:07 +08:00
commit f3f303e6e2
9 changed files with 33 additions and 19 deletions

View File

@ -801,11 +801,6 @@ class UsersController < ApplicationController
else
@user = User.find(params[:id])
end
if @user.user_score.nil?
us = UserScore.new
us.user_id = @user.id
us.save
end
rescue ActiveRecord::RecordNotFound
render_404
end

View File

@ -70,7 +70,7 @@ module JournalsHelper
content << textilizable(journal, :notes)
css_classes = "wiki"
css_classes << " editable" if editable
content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes ,:style => "width:580px")
end
def link_to_in_place_notes_editor(text, field_id, url, options={})

View File

@ -75,7 +75,12 @@ class Mailer < ActionMailer::Base
return -1
end
mail :to => journals_for_message.jour.author.mail, :subject => @title
else
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
if !journals_for_message.jour.author.notify_about? journals_for_message
return -1
end
mail :to => journals_for_message.jour.author.mail, :subject => @title
else
mail :to => @mail.mail, :subject => @title
end

View File

@ -246,6 +246,18 @@ class UserScore < ActiveRecord::Base
Rails.logger.error "[UserScore#project] ===> Exception: #{e}."
end
#获取用户的user_score
def self.score(user)
if user.user_score.nil?
us = UserScore.new
us.user_id = user.id
us.save
us
else
user.user_score
end
end
#计算总得分
def total_score
score = self.influence.to_i + self.skill.to_i + self.collaboration.to_i + self.active.to_i

View File

@ -24,7 +24,8 @@
<% end %>
<% end %>
<% if options[:author] %>
<span class="author"><%= h(attachment.author) %>, <%= format_time(attachment.created_on) %></span>
<!-- modified by zjc author添加超链接 -->
<span class="author"><%= link_to h(attachment.author),user_path(attachment.author) %>, <%= format_time(attachment.created_on) %></span>
<% end %>
</p>
<% end %>

View File

@ -98,7 +98,7 @@
<!-- modified by zjc 新得分显示 -->
<tr><td class="score">
<%= l(:label_user_grade)%>:
<%= link_to(format("%.2f" , @user.user_score.total_score).to_f, {:controller => 'users',
<%= link_to(format("%.2f" , @user.user_score_attr.total_score).to_f, {:controller => 'users',
:action => 'show_new_score',
:remote => true,
:id => @user.id

View File

@ -28,7 +28,7 @@
<div> = <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> +
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
<!-- <div>&nbsp;&nbsp;&nbsp;+ <%= l(:label_user_score_of_influence) %></div> -->
<div> = <%= format("%.2f" ,@user.user_score.collaboration.nil? ? 0:@user.user_score.collaboration).to_f %> + <%= format("%.2f" , @user.user_score.influence.nil? ? 0:@user.user_score.influence ).to_f %>
+ <%= format("%.2f" , @user.user_score.skill.nil? ? 0:@user.user_score.skill).to_f %> + <%= format("%.2f" , @user.user_score.active.nil? ? 0:@user.user_score.active).to_f %></div>
<div> = <%= format("%.2f" ,@user.user_score.total_score.nil? ? 0:@user.user_score.total_score).to_f %></div>
<div> = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %></div>
<div> = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_f %></div>
<!-- end -->

View File

@ -38,7 +38,7 @@
<td>
<table>
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score.total_score).to_f %></span></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_f %></span></td></tr>
</table>
</td>
</tr>
@ -49,23 +49,23 @@
<table style="border-bottom: solid 0px #80a6d2;" width="100%">
<tr>
<%= l(:label_user_score) %> :
<%= format("%.2f" , @user.user_score.total_score).to_f %>
<%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
</tr><br>
<tr>
<%= l(:label_user_score_of_collaboration) %> :
<%= format("%.2f" , @user.user_score.collaboration.nil? ? 0:@user.user_score.collaboration).to_f %>
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %>
</tr><br>
<tr>
<%= l(:label_user_score_of_influence) %> :
<%= format("%.2f" , @user.user_score.influence.nil? ? 0:@user.user_score.influence).to_f %>
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %>
</tr><br>
<tr>
<%= l(:label_user_score_of_skill) %> :
<%= format("%.2f" , @user.user_score.skill.nil? ? 0:@user.user_score.skill).to_f %>
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %>
</tr><br>
<tr>
<%= l(:label_user_score_of_active) %>
<%= format("%.2f" , @user.user_score.active.nil? ? 0:@user.user_score.active).to_f %>
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
</tr><br>
</table>

View File

@ -193,7 +193,8 @@
<% if(course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
<!-- modified by zjc 添加超链接 -->
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course',:school_id => course.school.id}, html_options={:method => 'get'}%>
<% end %>
</span>
<span class='font_bolder'>