实训反馈导出增加账号回复内容和时间

pre_develop
daiao 6 years ago
parent f027b52e4a
commit 40a1e1d034

@ -4295,7 +4295,7 @@ end
count_row = 1 count_row = 1
shixuns = Shixun.where(:id => shixun_ids).includes(discusses: [:user]) shixuns = Shixun.where(:id => shixun_ids).includes(discusses: [:user])
sheet1.row(0).concat(["序号", "实训ID", "实训名称", "实训作者", "作者单位", "评论数", "评论内容", "关卡", "评论者", "评论者职业", sheet1.row(0).concat(["序号", "实训ID", "实训名称", "实训作者", "作者单位", "评论数", "评论内容", "关卡", "评论者", "评论者职业",
"评论者单位", "评论时间", "社区导师是否已回复"]) "评论者单位", "评论时间", "社区导师是否已回复", "我的账号回复内容", "回复时间"])
shixuns.each_with_index do |shixun, i| shixuns.each_with_index do |shixun, i|
discusses = shixun.discusses.where("user_id != ?", 1) discusses = shixun.discusses.where("user_id != ?", 1)
if beginTime.present? if beginTime.present?
@ -4313,6 +4313,7 @@ end
discusses.each_with_index do |discuss, j| discusses.each_with_index do |discuss, j|
user = discuss.user user = discuss.user
content = discuss.content.gsub(/<img.*\/>/, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】") content = discuss.content.gsub(/<img.*\/>/, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】")
myself_discuss = discuss.children.where(user_id: User.current.id).last
sheet1[count_row, 6] = strip_html content sheet1[count_row, 6] = strip_html content
sheet1[count_row, 7] = "#{discuss.position}" sheet1[count_row, 7] = "#{discuss.position}"
sheet1[count_row, 8] = user.show_real_name sheet1[count_row, 8] = user.show_real_name
@ -4320,6 +4321,8 @@ end
sheet1[count_row, 10] = user.school_name sheet1[count_row, 10] = user.school_name
sheet1[count_row, 11] = format_time discuss.created_at sheet1[count_row, 11] = format_time discuss.created_at
sheet1[count_row, 12] = discuss.children.pluck(:user_id).include?(1) ? "" : "" sheet1[count_row, 12] = discuss.children.pluck(:user_id).include?(1) ? "" : ""
sheet1[count_row, 13] = myself_discuss.try(:content)
sheet1[count_row, 14] = myself_discuss ? (format_time myself_discuss.created_at) : ""
count_row += 1 count_row += 1
end end
#count_row += 1 #count_row += 1

Loading…
Cancel
Save