Merge branch 'develop' into szzh

This commit is contained in:
sw 2015-09-06 16:51:33 +08:00
commit abf053fc99
8 changed files with 116 additions and 72 deletions

View File

@ -386,6 +386,7 @@ class IssuesController < ApplicationController
end end
def add_journal def add_journal
if User.current.logged?
jour = Journal.new jour = Journal.new
jour.user_id = User.current.id jour.user_id = User.current.id
jour.notes = params[:notes] jour.notes = params[:notes]
@ -396,6 +397,7 @@ class IssuesController < ApplicationController
format.js format.js
end end
end end
end
private private

View File

@ -296,6 +296,7 @@ class UsersController < ApplicationController
#用户作业列表 #用户作业列表
def user_homeworks def user_homeworks
if User.current == @user
@page = params[:page] ? params[:page].to_i + 1 : 0 @page = params[:page] ? params[:page].to_i + 1 : 0
user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10) @homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
@ -303,6 +304,9 @@ class UsersController < ApplicationController
format.js format.js
format.html {render :layout => 'new_base_user'} format.html {render :layout => 'new_base_user'}
end end
else
render_403
end
end end
#导入作业 #导入作业
@ -345,6 +349,7 @@ class UsersController < ApplicationController
end end
def new_user_commit_homework def new_user_commit_homework
if User.current.logged?
@user = User.current @user = User.current
@homework = HomeworkCommon.find(params[:homework_id]) @homework = HomeworkCommon.find(params[:homework_id])
@is_test = params[:is_test] == 'true' @is_test = params[:is_test] == 'true'
@ -356,6 +361,9 @@ class UsersController < ApplicationController
format.js format.js
format.html {render :layout => 'new_base_user'} format.html {render :layout => 'new_base_user'}
end end
else
render_403
end
end end
def user_commit_homework def user_commit_homework
@ -364,6 +372,7 @@ class UsersController < ApplicationController
end end
def user_new_homework def user_new_homework
if User.current.logged?
if params[:homework_common] if params[:homework_common]
homework = HomeworkCommon.new homework = HomeworkCommon.new
homework.name = params[:homework_common][:name] homework.name = params[:homework_common][:name]
@ -412,6 +421,9 @@ class UsersController < ApplicationController
redirect_to user_homeworks_user_path(User.current.id) redirect_to user_homeworks_user_path(User.current.id)
end end
end end
else
render_403
end
end end
#用户从资源库导入资源到作业 #用户从资源库导入资源到作业

View File

@ -19,12 +19,23 @@
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
<%= stylesheet_link_tag 'base','header', :media => 'all'%>
</head> </head>
<body class="<%=h body_css_classes %>"> <body class="<%=h body_css_classes %>">
<div class="cl"></div>
<div class="navContainer mb10">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header',:locals=>{:name=>@name,:type=>@type} %>
<% else%>
<%= render :partial => 'layouts/unlogin_header',:locals=>{:name=>@name,:type=>@type} %>
<% end%>
</div>
<div class="cl"></div>
<div id="wrapper"> <div id="wrapper">
<div id="wrapper2"> <div id="wrapper2">
<div id="wrapper3"> <div id="wrapper3">
<%= render :partial => 'layouts/base_header'%>
<div id="main" class=""> <div id="main" class="">
<div id="sidebar"> <div id="sidebar">
@ -38,7 +49,6 @@
<%= call_hook :view_layouts_base_content %> <%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div> <div style="clear:both;"></div>
</div> </div>
<%= render :partial => 'layouts/base_footer'%>
</div> </div>
</div> </div>
@ -47,6 +57,11 @@
</div> </div>
</div> </div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</body> </body>
</html> </html>

View File

@ -5,4 +5,4 @@
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.update_issues')%> * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div> <div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.update_issues')%> * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_issues')%> * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div> <div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_issues')%> * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_messages')%> * 1 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div> <div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_messages')%> * 1 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> + <%= option_num.memo * 2 %> = <%= active(option_num) %> </div> <div>&nbsp;&nbsp;&nbsp; <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> + <%= option_num.memo * 2 %> = <%= project_active(option_num) %> </div>

View File

@ -5,8 +5,8 @@
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div> <%= 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>&nbsp;&nbsp;&nbsp;+ <%#= l(:label_user_score_of_influence) %></div> -->
<div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %> <div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %>
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" , active(option_num)).to_i %></div> + <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" ,project_active(option_num)).to_i %></div>
<% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , active(option_num)).to_i) < 0 %> <% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , project_active(option_num)).to_i) < 0 %>
<div><%= l(:label_score_less_than_zero) %></div> <div><%= l(:label_score_less_than_zero) %></div>
<% else %> <% else %>
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div> <div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>

View File

@ -68,7 +68,7 @@
</li> </li>
<li> <li>
<%= link_to l(:label_user_score_of_active), "javascript:void(0)", :onclick => "show_div('influence_new_score_index')" %> <%= link_to l(:label_user_score_of_active), "javascript:void(0)", :onclick => "show_div('influence_new_score_index')" %>
<%= format("%.2f" , active(option_num)).to_i %> <%= format("%.2f" , project_active(option_num)).to_i %>
</li> </li>
</ul> </ul>

View File

@ -0,0 +1,15 @@
class DeleteAnonymousJour < ActiveRecord::Migration
def up
jour_count = Journal.all.count / 30 + 2
transaction do
for i in 1 ... jour_count do i
Journal.page(i).per(30).each do |jour|
jour.destroy if jour.user_id == 2
end
end
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150906025009) do ActiveRecord::Schema.define(:version => 20150906083453) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false