white list for glcc pr check
This commit is contained in:
parent
e3b3dacde7
commit
6c44ecae2d
|
@ -11,6 +11,20 @@ class SettingsController < ApplicationController
|
||||||
get_top_system_notification
|
get_top_system_notification
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_url
|
||||||
|
url = params[:url]
|
||||||
|
task_id = params[:task]
|
||||||
|
term = params[:term]
|
||||||
|
return normal_status(-1, "缺少url参数") unless url.present?
|
||||||
|
return normal_status(-1, "缺少term参数") unless term.present?
|
||||||
|
return normal_status(-1, "缺少task参数") unless task_id.present?
|
||||||
|
glcc_mate = GlccMediumTermExamineMaterial.new(code_or_pr_url: url, task_id: task_id, term: term, created_on:Time.now)
|
||||||
|
state = glcc_mate.check_pr_url
|
||||||
|
errors = glcc_mate.gennerate_content(state)
|
||||||
|
render_ok({ state:state, state_html: errors})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
def get_navbar
|
def get_navbar
|
||||||
@navbar = default_laboratory.navbar
|
@navbar = default_laboratory.navbar
|
||||||
|
|
|
@ -40,10 +40,25 @@ class GlccMediumTermExamineMaterial < ActiveRecord::Base
|
||||||
unless pr.present?
|
unless pr.present?
|
||||||
state << 3
|
state << 3
|
||||||
end
|
end
|
||||||
|
if white_list && term == 1 #特殊处理 白名单的中期考核不处理 中期考核后去掉
|
||||||
|
state = []
|
||||||
|
end
|
||||||
state
|
state
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def white_list
|
||||||
|
# 全局设置白名单 key
|
||||||
|
key = "glcc_white_task_#{self.created_on.year}"
|
||||||
|
white_task = EduSetting.find_by_name(key)
|
||||||
|
if white_task
|
||||||
|
task_ids = white_task.value.split(",")
|
||||||
|
task_ids.map(&:to_i).include?(self.task_id)
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def send_mail
|
def send_mail
|
||||||
gcs = glcc_student
|
gcs = glcc_student
|
||||||
mail = gcs.mail
|
mail = gcs.mail
|
||||||
|
@ -52,11 +67,7 @@ class GlccMediumTermExamineMaterial < ActiveRecord::Base
|
||||||
state = check_pr_url
|
state = check_pr_url
|
||||||
return unless state.present?
|
return unless state.present?
|
||||||
title = "2023年GitLink确实开源GLCC开源夏令营#{term == 1 ? "中期考核" : "结项考核"}提醒"
|
title = "2023年GitLink确实开源GLCC开源夏令营#{term == 1 ? "中期考核" : "结项考核"}提醒"
|
||||||
content = ""
|
content = gennerate_content(state)
|
||||||
state.map{|e|
|
|
||||||
content = content + number_to_content(e)
|
|
||||||
}
|
|
||||||
puts content
|
|
||||||
UserMailer.glcc_pr_check_email(mail,title, gcs.student_name, content).deliver_now
|
UserMailer.glcc_pr_check_email(mail,title, gcs.student_name, content).deliver_now
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,6 +76,10 @@ class GlccMediumTermExamineMaterial < ActiveRecord::Base
|
||||||
mail = gcs.mail
|
mail = gcs.mail
|
||||||
return "数据异常PR连接为空" if mail.nil? || code_or_pr_url.nil?
|
return "数据异常PR连接为空" if mail.nil? || code_or_pr_url.nil?
|
||||||
state = check_pr_url
|
state = check_pr_url
|
||||||
|
gennerate_content(state)
|
||||||
|
end
|
||||||
|
|
||||||
|
def gennerate_content(state)
|
||||||
content = ""
|
content = ""
|
||||||
state.map{|e|
|
state.map{|e|
|
||||||
content = content + number_to_content(e)
|
content = content + number_to_content(e)
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
<th width="13%">邮件地址</th>
|
<th width="13%">邮件地址</th>
|
||||||
<th width="6%">视频地址</th>
|
<th width="6%">视频地址</th>
|
||||||
<th width="6%">PR地址</th>
|
<th width="6%">PR地址</th>
|
||||||
<th width="14%">考核阶段</th>
|
<th width="5%">考核阶段</th>
|
||||||
|
<th width="5%">白名单</th>
|
||||||
<th width="14%">检测状态</th>
|
<th width="14%">检测状态</th>
|
||||||
<th width="14%">提交时间</th></th>
|
<th width="14%">提交时间</th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
<td><a target="_blank" href="<%= user.defence_video_url %>"> 查看视频 </a></></td>
|
<td><a target="_blank" href="<%= user.defence_video_url %>"> 查看视频 </a></></td>
|
||||||
<td><a target="_blank" href="<%= user.code_or_pr_url %>"> 查看PR </a></></td>
|
<td><a target="_blank" href="<%= user.code_or_pr_url %>"> 查看PR </a></></td>
|
||||||
<td><%= user.term == 1 ? "中期考核" : "结项考核"%></td>
|
<td><%= user.term == 1 ? "中期考核" : "结项考核"%></td>
|
||||||
|
<td><%= user.white_list ? "是":"否" %></td>
|
||||||
<td><%= user.state_to_html.html_safe %></td>
|
<td><%= user.state_to_html.html_safe %></td>
|
||||||
<td><%= user.created_on.strftime("%Y-%m-%d %H:%M")%></td>
|
<td><%= user.created_on.strftime("%Y-%m-%d %H:%M")%></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -19,6 +19,7 @@ Rails.application.routes.draw do
|
||||||
get 'attachments/entries/get_file', to: 'attachments#get_file'
|
get 'attachments/entries/get_file', to: 'attachments#get_file'
|
||||||
get 'attachments/download/:id', to: 'attachments#show'
|
get 'attachments/download/:id', to: 'attachments#show'
|
||||||
get 'attachments/download/:id/:filename', to: 'attachments#show'
|
get 'attachments/download/:id/:filename', to: 'attachments#show'
|
||||||
|
get 'check_pr_url',to: "settings#check_url"
|
||||||
|
|
||||||
# get 'auth/qq/callback', to: 'oauth/qq#create'
|
# get 'auth/qq/callback', to: 'oauth/qq#create'
|
||||||
get 'auth/failure', to: 'oauth/base#auth_failure'
|
get 'auth/failure', to: 'oauth/base#auth_failure'
|
||||||
|
|
Loading…
Reference in New Issue