Merge branch 'develop' into cxt_course

Conflicts:
	app/views/users/_join_course_course_message.html.erb
This commit is contained in:
cxt 2016-07-12 16:26:13 +08:00
commit c46fcc48b1
12 changed files with 74 additions and 76 deletions

View File

@ -61,7 +61,7 @@ class AdminController < ApplicationController
if params[:syllabus_id] && params[:course_id]
course = Course.where("id = #{params[:course_id].to_i}").first
unless course.nil?
course.update_attribute('syllabus_id', params[:syllabus_id].to_i)
course.update_column('syllabus_id', params[:syllabus_id].to_i)
@flag = true
end
end
@ -124,11 +124,11 @@ class AdminController < ApplicationController
end
end
#修改课程名称
#修改班级名称
def update_course_name
@course = Course.where("id = #{params[:course_id].to_i}").first
unless @course.nil?
@course.update_attribute("name", params[:name])
@course.update_column("name", params[:name])
respond_to do |format|
format.js
end

View File

@ -114,7 +114,7 @@ class QualityAnalysisController < ApplicationController
end
end
rescue => e
puts e
@message = e.message
end
respond_to do |format|
if @current_build_status == "success"
@ -227,9 +227,6 @@ class QualityAnalysisController < ApplicationController
end
@ha.store(key,value)
end
issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
@sonar_issues = JSON.parse(issue_date).first
end
rescue => e
puts e

View File

@ -3,16 +3,16 @@ module QualityAnalysisHelper
def sqale_rating_status val
arr = []
if val < 5
if val <= 5
arr << "很好"
arr << "b_green2"
elsif val. > 5 && val < 10
elsif val. > 5 && val <= 10
arr << "较好"
arr << "b_slow_yellow"
elsif val > 10 && val < 20
elsif val > 10 && val <= 20
arr << "中等"
arr << "b_yellow"
elsif val > 20 && val < 50
elsif val > 20 && val <= 50
arr << "较差"
arr << "b_slow_red"
elsif val > 20
@ -23,10 +23,10 @@ module QualityAnalysisHelper
def complexity_status val
arr = []
if val < 10
if val <= 10
arr << "良好"
arr << "b_green2"
elsif val > 10 && val < 15
elsif val > 10 && val <= 15
arr << "较高"
arr << "b_yellow"
elsif val > 15
@ -37,10 +37,10 @@ module QualityAnalysisHelper
def duplicated_lines_density_status val
arr = []
if val < 30
if val <= 30
arr << "良好"
arr << "b_green2"
elsif val > 30 && val < 50
elsif val > 30 && val <= 50
arr << "较高"
arr << "b_yellow"
elsif val > 50
@ -51,10 +51,10 @@ module QualityAnalysisHelper
def comment_lines_density_status val
arr = []
if val < 20
if val <= 20
arr << "较低"
arr << "b_yellow"
elsif val > 20 && val < 50
elsif val > 20 && val <= 50
arr << "正常"
arr << "b_green2"
elsif val > 50
@ -64,15 +64,15 @@ module QualityAnalysisHelper
end
def score_sqale_rating val
if val > 0 && val < 5
if val >= 0 && val <= 5
"5"
elsif val > 5 && val < 10
elsif val > 5 && val <= 10
"4"
elsif val > 10 && val < 20
elsif val > 10 && val <= 20
"3"
elsif val > 20 && val < 50
elsif val > 20 && val <= 50
"2"
elsif val > 20
elsif val > 50
"1"
end
end

View File

@ -17,7 +17,8 @@
</td>
<td class="center">
<%= course.is_delete == 0 ? '正常' : '归档' %>
</td><td class="center">
</td>
<td class="center">
<%= format_date(course.created_at) %>
</td>
<td class="center">

View File

@ -27,10 +27,10 @@
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
<th style="width: 20px;">
序号
</th>
<th style="width: 85px;">
<th style="width: 70px;">
班级
</th>
<th style="width: 35px;">
@ -42,6 +42,9 @@
<th style="width: 15px;">
<%=l(:field_is_public)%>
</th>
<th style="width: 20px;">
状态
</th>
<th style="width: 45px;">
<%=l(:field_created_on)%>
</th>
@ -63,7 +66,7 @@
<td style="text-align: center;">
<%= course.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>' id="syllabus_course_name_<%=course.id %>">
<span>
<a title="<%=course.name %>" id="rename_course_name_<%=course.id %>" ondblclick="rename_course_name($(this),'<%=course.name %>','<%=course.id %>');"><%= course.name%></a>
</span>
@ -77,6 +80,9 @@
<td class="center">
<%= checked_image course.is_public? %>
</td>
<td class="center">
<%= course.is_delete == 0 ? '正常' : '归档' %>
</td>
<td class="center">
<%= format_date(course.created_at) %>
</td>

View File

@ -17,10 +17,10 @@
<% if @quality_analyses.count >0 %>
<% @quality_analyses.each do |qa| %>
<ul class="analysis-result-list">
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2" %></li>
<li class="analysis-result-version fl fontBlue2" title="分支名"><%= qa.branch %></li>
<li class="analysis-result-loc fl fontBlue2" title="语言"><%= qa.language %></li>
<li class="analysis-result-debt fl fontBlue2" title="时间"><%= qa.path %></li>
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2 hidden" %></li>
<li class="analysis-result-version fl fontBlue2 hidden" title="分支名"><%= qa.branch %></li>
<li class="analysis-result-loc fl fontBlue2 hidden" title="语言"><%= qa.language %></li>
<li class="analysis-result-debt fl fontBlue2 hidden" title="路径"><%= qa.path %></li>
<% if User.current.try(:login) == qa.author_login %>
<li class="analysis-result-time fl" title="编辑">
<%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %>

View File

@ -58,17 +58,17 @@
<span class="fontGrey2">可定性评价为:<span class="c_red">质量<%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %></span></span></div>
<div class="analysis-block mt10 mb40 f14">
<div><span class="fontGrey3 mr30">技术债务</span>
<span class="w70 pInline">
<span class="w100 pInline">
<% if @ha["sqale_index"].to_i == 0 %>
0
0
<% else %>
<%= /[0-9]*/.match(@ha["sqale_index"])[0] %>天
<%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? 0 : / [0-9]*/.match(@ha["sqale_index"]) %>小时
<%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? "" : (/ [0-9]*/.match(@ha["sqale_index"]).to_s + "小时") %>
<% end %>
</span>
<span class="fontGrey2"><a class="linkBlue2" target="_blank" href="<%= @sonar_address %>/drilldown/measures/<%= @resource_id %>?metric=sqale_index">查看详情</a></span></div>
<div><span class="fontGrey3 mr30 fl">质量问题</span>
<span class="fontBlue2 w70 pInline">
<div><span class="fontGrey3 mr30 fl">&nbsp;质量问题</span>
<span class="fontBlue2 w100 pInline">
<a class="fontBlue2 w70 pInline" target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false">
<%= @ha["violations"].nil? ? 0 : @ha["violations"] %>
</a>

View File

@ -1,14 +1,6 @@
<% if @name_flag %>
<%= render :partial => "result_list" %>
<% else %>
<% if params[:current_build_status].nil? || params[:current_build_status] == "success" %>
<%= render :partial => "show", :locals => {:branch => @branch} %>
<% else %>
<% if params[:build_console_result] %>
运行结果超时
<% else %>
<%= render :partial => "console_output" %>
<% end %>
<% end %>
<%= render :partial => "show", :locals => {:branch => @branch} %>
<% end %>

View File

@ -18,8 +18,7 @@
<p>真实姓名:<%= User.find(ma.course_message_id).realname %></p>
<p>申请课程:<%= Course.find(ma.course_id).name%></p>
<div class="fl">课程描述:</div>
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %></div>
<p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %></div> <p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
</div>
<li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContentWarn2' : 'homepageHomeworkContentWarn' %> fl">
<span id="deal_info_<%=ma.id%>">

View File

@ -1,5 +1,5 @@
<% if ma.class == CourseMessage %>
<% if ma.course_message_type == "News" %>
<% if ma.course_message_type == "News" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了通知:</span></li>
@ -19,7 +19,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Comment" %>
<% if ma.course_message_type == "Comment" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了通知:</span></li>
@ -39,7 +39,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
<% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
@ -98,7 +98,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + '老师',
@ -133,7 +133,7 @@
</ul>
<% end %>
<!--作品开启匿评 待整合:时间紧-->
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
@ -168,7 +168,7 @@
</ul>
<% end %>
<!--作品关闭匿评-->
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">
@ -199,7 +199,7 @@
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
@ -235,18 +235,18 @@
</ul>
<% end %>
<!--资源申请-->
<% if ma.course_message_type == "ApplyResource" && ma.status == 0 %>
<% if ma.course_message_type == "ApplyResource" && ma.status == 0 && ma.course_message %>
<ul class="homepageNewsList fl" id="apply_resource_message_<%=ma.id %>">
<%= render :partial => 'apply_resource_course_message', :locals => {:ma => ma} %>
</ul>
<% end %>
<!--资源申请回复-->
<% if ma.course_message_type == "ApplyResource" && ma.status == 1 %>
<% if ma.course_message_type == "ApplyResource" && ma.status == 1 && ma.course_message %>
<ul class="homepageNewsList fl" id="apply_resource_message_<%=ma.id %>">
<%= render :partial => 'apply_resource_course_message_reply', :locals => {:ma => ma} %>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag(url_to_avatar(User.find(ma.apply_user_id)), width: "30px", height: "30px", class: "mt3") %></div></a></li>
<li class="homepageNewsPubType fl">
@ -271,7 +271,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Poll" %>
<% if ma.course_message_type == "Poll" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了问卷:</span></li>
@ -287,7 +287,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Message" %>
<% if ma.course_message_type == "Message" && !ma.nil? && !ma.course_message.nil? %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">
@ -376,7 +376,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "JournalsForMessage" %>
<% if ma.course_message_type == "JournalsForMessage" && ma.course_message %>
<% if ma.course_message.jour_type == 'Course' %>
<% if params[:type] != 'homework' %>
<ul class="homepageNewsList fl">
@ -459,7 +459,7 @@
<% end %>
<% end %>
<!-- 作业迟交,不能参与匿评提醒消息 -->
<% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %>
<% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">
@ -493,7 +493,7 @@
<% end %>
<% if ma.course_message_type == "StudentWork" && ma.status == 1 %>
<% if ma.course_message_type == "StudentWork" && ma.status == 1 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
@ -514,7 +514,7 @@
</ul>
<% end %>
<!-- 学生追加作品附件 -->
<% if ma.course_message_type == "StudentWork" && ma.status == 2 %>
<% if ma.course_message_type == "StudentWork" && ma.status == 2 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
@ -534,7 +534,7 @@
</ul>
<% end %>
<!-- 创建课程消息 -->
<% if ma.course_message_type == "Course" %>
<% if ma.course_message_type == "Course" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a>
@ -569,7 +569,9 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "JoinCourseRequest" %>
<!--# ma.course_message_id 是用户id-->
<% if ma.course_message_type == "JoinCourseRequest" && !ma.nil? %>
<ul class="homepageNewsList fl" id="course_message_join_<%=ma.id %>">
<%= render :partial => 'join_course_course_message', :locals => {:ma => ma} %>
</ul>
@ -710,7 +712,7 @@
<% end %>
<!--老师发布测验 发给学生看-->
<% if ma.course_message_type == "Exercise" && ma.status == 2 %>
<% if ma.course_message_type == "Exercise" && ma.status == 2 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">
@ -747,7 +749,7 @@
<% end %>
<% if ma.course_message_type == "Exercise" && ma.status == 3 %>
<% if ma.course_message_type == "Exercise" && ma.status == 3 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">

View File

@ -20,8 +20,8 @@ namespace :update_homework do
project_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last
puts "the time is =========================> #{time}"
puts "the project_time is =========================> #{project_time}"
#if time.strftime('%Y-%m-%d %H:%M:%S') < project_time.strftime('%Y-%m-%d %H:%M:%S')
if format_time(time) < format_time(project_time)
if time.strftime('%Y-%m-%d %H:%M:%S') < project_time.strftime('%Y-%m-%d %H:%M:%S')
#if format_time(time) < format_time(project_time)
time = project_time
end
begin
@ -33,9 +33,10 @@ namespace :update_homework do
unless changesets[0].blank?
puts "the time is =========================> #{time}"
puts "the changesets_latest_coimmit is =========================> #{changesets_latest_coimmit.created_at}"
#if time.strftime('%Y-%m-%d %H:%M:%S') < changesets_latest_coimmit.created_at.strftime('%Y-%m-%d %H:%M:%S')
if format_time(time) < format_time(changesets_latest_coimmit.created_at)
time = changesets_latest_coimmit.created_at
puts "the distance time is =========================> #{changesets_latest_coimmit.created_at.to_time > Time.now}"
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
end
end
rescue Exception => e

View File

@ -1273,11 +1273,11 @@ a.pages-big{ width:50px;}
.analysis-result-list {padding:5px;}
.analysis-result-list:nth-of-type(odd){background:#fff;}/*奇数行*/
.analysis-result-list:nth-of-type(even){background:#f5f5f5;}/*偶数行*/
.analysis-result-name {width:200px; cursor:pointer;}
.analysis-result-version {width:90px; text-align:right; cursor:pointer;}
.analysis-result-loc {width:60px; text-align:right; cursor:pointer;}
.analysis-result-debt {width:160px; text-align:right; cursor:pointer;}
.analysis-result-time {width:150px; text-align:right; cursor:pointer;}
.analysis-result-name {width:200px;}
.analysis-result-version {width:90px; text-align:right;}
.analysis-result-loc {width:60px; text-align:right;}
.analysis-result-debt {width:160px; text-align:right;}
.analysis-result-time {width:150px; text-align:right;}
.analysis-name-icon {background:url(../images/code-analysis-icon.png) -2px -148px no-repeat; width:16px; height:16px; display:inline-block; vertical-align:middle;}
/*未登录回复提示*/