作业动态的时间
This commit is contained in:
parent
48e5a0be7e
commit
c9e0143fe8
|
@ -2992,7 +2992,7 @@ int main(int argc, char** argv){
|
|||
unless projects.empty?
|
||||
project_ids = '('+projects.map{|pro|pro.project_id}.join(',')+')'
|
||||
sort_projects = ForgeActivity.find_by_sql("SELECT MAX(updated_at) AS updated_at,user_id, project_id FROM forge_activities WHERE project_id IN #{project_ids} GROUP BY project_id ORDER BY MAX(updated_at) DESC")
|
||||
|
||||
#sort_projects = sort_projects.sort_by{|sp| (!sp.project.project_score.nil? && !sp.project.project_score.commit_time.nil?) ? '' : sp.project.project_score.commit_time}
|
||||
return sort_projects
|
||||
end
|
||||
end
|
||||
|
|
|
@ -198,10 +198,8 @@
|
|||
<%# first_pro = sort_projects.first %>
|
||||
<% first_pro = Project.find sort_projects.first.project_id %>
|
||||
<% commit_time = first_pro.project_score.commit_time %>
|
||||
<% one_time = first_pro.updated_on %>
|
||||
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
|
||||
<% one_time= one_time > one_forge_time ? one_time : one_forge_time %>
|
||||
# <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_time) ? commit_time : one_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
|
||||
# <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% sort_projects.each_with_index do |pro, i| %>
|
||||
|
|
|
@ -208,10 +208,8 @@
|
|||
<div class="mr5 fontGrey2">
|
||||
<% first_pro = Project.find sort_projects.first.project_id %>
|
||||
<% commit_time = first_pro.project_score.commit_time %>
|
||||
<% one_time = first_pro.updated_on %>
|
||||
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
|
||||
<% one_time= one_time > one_forge_time ? one_time : one_forge_time %>
|
||||
# <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_time) ? commit_time : one_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
|
||||
# <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% sort_projects.each_with_index do |pro, i| %>
|
||||
|
|
|
@ -29,6 +29,12 @@ namespace :update_homework do
|
|||
changesets = g.commits(project.gpid, :ref_name => default_branch)
|
||||
changesets_latest_coimmit = changesets[0]
|
||||
unless changesets[0].blank?
|
||||
project_score = project.project_score
|
||||
if project_score.nil?
|
||||
ProjectScore.create(:project_id => project.id, :score => false)
|
||||
else
|
||||
project_score.update_column(:commit_time, changesets_latest_coimmit.created_at.to_time)
|
||||
end
|
||||
if time.strftime('%Y-%m-%d %H:%M:%S') < changesets_latest_coimmit.created_at.to_time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
#if format_time(time) < format_time(changesets_latest_coimmit.created_at)
|
||||
time = changesets_latest_coimmit.created_at.to_time
|
||||
|
|
Loading…
Reference in New Issue