关联项目的更新时间包含项目的提交时间
This commit is contained in:
parent
6789693fc7
commit
f7be78efc7
|
@ -190,10 +190,11 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
|
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% com_time = project.project_score.commit_time %>
|
||||||
<% time=project.updated_on %>
|
<% time=project.updated_on %>
|
||||||
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
||||||
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
||||||
<p class="mh18"><%=time_from_now time %> <%= project.project_score.changeset_num %>提交</p>
|
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %> <%= project.project_score.changeset_num %>提交</p>
|
||||||
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
|
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
|
||||||
项目名称:<%=project.name %><br />
|
项目名称:<%=project.name %><br />
|
||||||
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
||||||
|
|
|
@ -189,10 +189,11 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
|
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% com_time = project.project_score.commit_time %>
|
||||||
<% time=project.updated_on %>
|
<% time=project.updated_on %>
|
||||||
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
||||||
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
||||||
<p class="mh18"><%=time_from_now time %> <%= project.project_score.changeset_num %>提交</p>
|
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %> <%= project.project_score.changeset_num %>提交</p>
|
||||||
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
|
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
|
||||||
项目名称:<%=project.name %><br />
|
项目名称:<%=project.name %><br />
|
||||||
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
||||||
|
|
|
@ -156,7 +156,7 @@
|
||||||
<% break %>
|
<% break %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if student_works > 5%>
|
<% if student_works.count > 5%>
|
||||||
<%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
<%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
@ -191,10 +191,11 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %>
|
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% com_time = project.project_score.commit_time %>
|
||||||
<% time=project.updated_on %>
|
<% time=project.updated_on %>
|
||||||
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
||||||
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
||||||
<p class="mh18"><%=time_from_now time %> <%= project.project_score.changeset_num %>提交</p>
|
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %> <%= project.project_score.changeset_num %>提交</p>
|
||||||
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
|
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
|
||||||
项目名称:<%=project.name %><br />
|
项目名称:<%=project.name %><br />
|
||||||
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
class AddCommitTime < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :project_scores, :commit_time, :datetime, :default => nil
|
||||||
|
count = ProjectScore.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
ProjectScore.page(i).per(30).each do |ps|
|
||||||
|
unless ps.project.nil?
|
||||||
|
unless ps.project.gpid.nil?
|
||||||
|
g = Gitlab.client
|
||||||
|
begin
|
||||||
|
changesets = g.commits(ps.project.gpid)
|
||||||
|
ps.commit_time = changesets[0].created_at
|
||||||
|
ps.save
|
||||||
|
rescue
|
||||||
|
logger.error("The project's rep is not exit!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue