Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

schedule_job
anke1460 5 years ago
commit e0e9c3c147

@ -330,7 +330,7 @@ class ApplicationController < ActionController::Base
end end
if !User.current.logged? && Rails.env.development? if !User.current.logged? && Rails.env.development?
User.current = User.find 1 User.current = User.find 3117
end end

@ -0,0 +1,21 @@
class CollectionsController < ApplicationController
before_action :require_login
def create
tip_exception("勿重复收藏") if current_user.collections.find_by(create_params).present?
current_user.collections.create!(create_params)
normal_status("收藏成功,您可以在个人主页对应的栏目中查看")
end
def cancel
collection = current_user.collections.find_by!(create_params)
collection.destroy!
normal_status("操作成功")
end
private
def create_params
params.permit(:container_id, :container_type)
end
end

@ -102,18 +102,7 @@ class ExerciseAnswersController < ApplicationController
normal_status(-1,"已提交/已结束的试卷不允许修改!") normal_status(-1,"已提交/已结束的试卷不允许修改!")
else else
if (@exercise_user_status == Exercise::DEADLINE && @exercise_user.commit_status == 0) || (@exercise.time > 0 && @exercise_user.start_at.present? && ((@exercise_user.start_at + @exercise.time.to_i.minutes) < Time.now)) if (@exercise_user_status == Exercise::DEADLINE && @exercise_user.commit_status == 0) || (@exercise.time > 0 && @exercise_user.start_at.present? && ((@exercise_user.start_at + @exercise.time.to_i.minutes) < Time.now))
objective_score = calculate_student_score(@exercise,current_user,Time.now)[:total_score] commit_exercise_user @exercise, @exercise_user
subjective_score = @exercise_user.subjective_score < 0.0 ? 0.0 : @exercise_user.subjective_score
total_score = objective_score + subjective_score
commit_option = {
:status => 1,
:commit_status => 1,
:end_at => Time.now,
:objective_score => objective_score,
:score => total_score,
:subjective_score => subjective_score
}
@exercise_user.update!(commit_option)
normal_status(-1,"试卷提交时间已截止!") normal_status(-1,"试卷提交时间已截止!")
end end
end end

@ -816,7 +816,7 @@ class ExercisesController < ApplicationController
ex_user_ids = exercise_users.pluck(:id) ex_user_ids = exercise_users.pluck(:id)
EndExerciseCalculateJob.perform_later(ex_user_ids, exercise, Time.now.to_s) EndExerciseCalculateJob.perform_later(ex_user_ids, exercise, Time.now.to_s, true, 4)
# exercise_users.each do |user| # exercise_users.each do |user|
# if user.commit_status == 0 && user.start_at.present? # if user.commit_status == 0 && user.start_at.present?
# objective_score = calculate_student_score(exercise,user.user)[:total_score] # objective_score = calculate_student_score(exercise,user.user)[:total_score]
@ -982,11 +982,17 @@ class ExercisesController < ApplicationController
@shixun_undo = 0 @shixun_undo = 0
@ques_undo = 0 @ques_undo = 0
ex_answer_time = @exercise.time.to_i ex_answer_time = @exercise.time.to_i
exercise_user = @exercise.exercise_users.find_by(user_id: current_user.id)
if ex_answer_time > 0 #有剩余时间的时候 if ex_answer_time > 0 #有剩余时间的时候
user_left_time = get_exercise_left_time(@exercise, current_user) user_left_time = get_exercise_left_time(@exercise, current_user)
@ex_end_time = Time.now + user_left_time.to_i.seconds @ex_end_time = Time.now + user_left_time.to_i.seconds
# 提交用户试卷
commit_exercise_user @exercise, exercise_user if user_left_time.nil?
else else
@ex_end_time = @exercise.get_exercise_end_time(current_user.id) @ex_end_time = @exercise.get_exercise_end_time(current_user.id)
commit_exercise_user @exercise, exercise_user if @ex_end_time < Time.now
end end
# @ex_end_time = @exercise.get_exercise_end_time(current_user.id) # @ex_end_time = @exercise.get_exercise_end_time(current_user.id)
# if ex_answer_time > 0 # if ex_answer_time > 0
@ -1033,20 +1039,7 @@ class ExercisesController < ApplicationController
can_commit_exercise = true can_commit_exercise = true
end end
if can_commit_exercise if can_commit_exercise
objective_score = calculate_student_score(@exercise, current_user, Time.now)[:total_score] commit_exercise_user @exercise, @answer_committed_user, Time.now
subjective_score = @answer_committed_user.subjective_score
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
total_score = objective_score + total_score_subjective_score
commit_option = {
:status => 1,
:commit_status => 1,
:end_at => Time.now,
:objective_score => objective_score,
:score => total_score,
:subjective_score => subjective_score,
:commit_method => @answer_committed_user&.commit_method.to_i > 0 ? @answer_committed_user&.commit_method.to_i : params[:commit_method].to_i
}
@answer_committed_user.update!(commit_option)
CommitExercsieNotifyJobJob.perform_later(@exercise.id, current_user.id) CommitExercsieNotifyJobJob.perform_later(@exercise.id, current_user.id)
normal_status(0, "试卷提交成功!") normal_status(0, "试卷提交成功!")
else else
@ -1197,10 +1190,19 @@ class ExercisesController < ApplicationController
@exercise_users_size = @exercise_users_list.size @exercise_users_size = @exercise_users_list.size
if @exercise.time > 0
start_time = Time.current - @exercise.time * 60
ex_user_ids = @exercise_users_list.where("start_at <= '#{Time.at(start_time)}' and commit_status = 0").pluck(:user_id)
if ex_user_ids.size > 0
EndExerciseCalculateJob.perform_later(ex_user_ids, @exercise, Time.now.to_s, false, 2)
end
end
# 分页 # 分页
@page = params[:page] || 1 @page = params[:page] || 1
@limit = params[:limit] || 20 @limit = params[:limit] || 20
@exercise_users_list = @exercise_users_list.page(@page).per(@limit) @exercise_users_list = @exercise_users_list.page(@page).per(@limit)
else else
@exercise_users_list = [] @exercise_users_list = []
@export_ex_users = @exercise_users_list @export_ex_users = @exercise_users_list

@ -961,4 +961,36 @@ module ExercisesHelper
def content_line(content) def content_line(content)
content.split(/\r?\n/).length + 1 content.split(/\r?\n/).length + 1
end end
def commit_exercise_user exercise, exercise_user, commit_time = nil
exercise_end_time = exercise.get_exercise_end_time(exercise_user.user_id) #没有考虑分班的情况
objective_score = calculate_student_score(exercise, exercise_user.user, exercise_end_time)[:total_score]
subjective_score = exercise_user.subjective_score < 0.0 ? 0.0 : exercise_user.subjective_score
total_score = objective_score + subjective_score
if commit_time.nil?
if exercise.time > 0
start_time = Time.at(exercise_user.start_at + exercise.time * 60)
end_time = start_time > exercise_end_time ? exercise_end_time : start_time
commit_method = start_time > exercise_end_time ? 3 : 2
else
commit_method = 3
end_time = exercise_end_time
end
else
commit_method = 1
end
commit_time = commit_time.present? && end_time > commit_time ? commit_time : end_time
commit_option = {
:status => 1,
:commit_status => 1,
:end_at => commit_time,
:objective_score => objective_score,
:score => total_score,
:subjective_score => subjective_score,
:commit_method => commit_method
}
exercise_user.update!(commit_option)
end
end end

@ -2,7 +2,9 @@ module Weapps::AttendancesHelper
def student_attendance_status attendance, user def student_attendance_status attendance, user
st_attendance = attendance.course_member_attendances.find_by(user_id: user.id) st_attendance = attendance.course_member_attendances.find_by(user_id: user.id)
st_attendance.present? ? st_attendance.attendance_status : "ABSENCE" attendance_status = st_attendance.present? ? st_attendance.attendance_status : "ABSENCE"
attendance_mode = st_attendance.present? ? st_attendance.attendance_mode : "DEFAULT"
{attendance_status: attendance_status, attendance_mode: attendance_mode}
end end
def group_attendance_count attendances, member_ids def group_attendance_count attendances, member_ids

@ -5,10 +5,12 @@ class EndExerciseCalculateJob < ApplicationJob
queue_as :default queue_as :default
def perform(ex_user_ids,exercise,end_time) def perform(ex_user_ids,exercise,end_time,work_time,commit_method)
exercise_users = ExerciseUser.where(id: ex_user_ids) exercise_users = ExerciseUser.where(id: ex_user_ids)
exercise_users.each do |user| exercise_users.each do |user|
if user.commit_status == 0 && user.start_at.present? if user.commit_status == 0 && user.start_at.present?
end_at = work_time ? end_time : Time.at(user.start_at + exercise.time * 60)
objective_score = calculate_student_score(exercise,user.user,end_time.to_time)[:total_score] objective_score = calculate_student_score(exercise,user.user,end_time.to_time)[:total_score]
user_sub_score = user.subjective_score user_sub_score = user.subjective_score
subjective_score = user_sub_score < 0.0 ? 0.0 : user_sub_score subjective_score = user_sub_score < 0.0 ? 0.0 : user_sub_score
@ -16,11 +18,11 @@ class EndExerciseCalculateJob < ApplicationJob
commit_option = { commit_option = {
:status => 1, :status => 1,
:commit_status => 1, :commit_status => 1,
:end_at => Time.now, :end_at => end_at,
:objective_score => objective_score, :objective_score => objective_score,
:score => total_score, :score => total_score,
:subjective_score => user_sub_score, :subjective_score => user_sub_score,
:commit_method => user&.commit_method.to_i > 0 ? user&.commit_method.to_i : 4 :commit_method => user&.commit_method.to_i > 0 ? user&.commit_method.to_i : commit_method
} }
user.update_attributes(commit_option) user.update_attributes(commit_option)
end end

@ -0,0 +1,7 @@
class Collection < ApplicationRecord
belongs_to :user
belongs_to :container, polymorphic: true, optional: true
scope :shixuns, -> {where(container_type: 'Shixun')}
scope :subjects, -> {where(container_type: 'Subject')}
end

@ -53,6 +53,9 @@ class Shixun < ApplicationRecord
has_many :shixun_service_configs, :dependent => :destroy has_many :shixun_service_configs, :dependent => :destroy
has_many :tidings, as: :container, dependent: :destroy has_many :tidings, as: :container, dependent: :destroy
# 收藏
has_many :collections, as: :container, dependent: :destroy
# 实训审核记录 # 实训审核记录
has_many :shixun_reviews, -> {order("shixun_reviews.created_at desc")}, :dependent => :destroy has_many :shixun_reviews, -> {order("shixun_reviews.created_at desc")}, :dependent => :destroy

@ -16,6 +16,9 @@ class Subject < ApplicationRecord
has_many :subject_appointments, dependent: :destroy has_many :subject_appointments, dependent: :destroy
# 收藏
has_many :collections, as: :container, dependent: :destroy
has_many :subject_members, ->{ order("subject_members.position asc")}, dependent: :destroy has_many :subject_members, ->{ order("subject_members.position asc")}, dependent: :destroy
has_many :users, through: :subject_members has_many :users, through: :subject_members
has_many :tidings, as: :container, dependent: :destroy has_many :tidings, as: :container, dependent: :destroy

@ -117,6 +117,11 @@ class User < ApplicationRecord
has_many :manage_course_members, -> { teachers_and_admin }, class_name: 'CourseMember' has_many :manage_course_members, -> { teachers_and_admin }, class_name: 'CourseMember'
has_many :manage_courses, through: :manage_course_members, source: :course has_many :manage_courses, through: :manage_course_members, source: :course
has_many :collections, dependent: :destroy
has_many :shixun_collections, -> { shixuns }, class_name: 'Collection'
has_many :subject_collections, -> { subjects }, class_name: 'Collection'
# 关注 # 关注
# has_many :be_watchers, foreign_key: :user_id, dependent: :destroy # 我的关注 # has_many :be_watchers, foreign_key: :user_id, dependent: :destroy # 我的关注
# has_many :be_watcher_users, through: :be_watchers, dependent: :destroy # 我关注的用户 # has_many :be_watcher_users, through: :be_watchers, dependent: :destroy # 我关注的用户
@ -419,6 +424,10 @@ class User < ApplicationRecord
end end
end end
def is_collect? container
collections.where(container: container).exists?
end
# 实训用户身份 # 实训用户身份
def shixun_identity(shixun) def shixun_identity(shixun)
@identity = @identity =

@ -24,15 +24,17 @@ class Users::ShixunService
user.study_shixuns.where(shixuns: {id: laboratory.shixuns}) user.study_shixuns.where(shixuns: {id: laboratory.shixuns})
when 'manage' then when 'manage' then
laboratory.shixuns.where(id: user.shixuns) laboratory.shixuns.where(id: user.shixuns)
when 'collect' then
laboratory.shixuns.where(id: user.shixun_collections.pluck(:container_id))
else else
ids = user.study_shixuns.pluck(:id) + user.shixuns.pluck(:id) ids = user.study_shixuns.pluck(:id) + user.shixuns.pluck(:id) + user.shixun_collections.pluck(:container_id)
laboratory.shixuns.where(id: ids) laboratory.shixuns.where(id: ids)
end end
end end
def status_filter(relations) def status_filter(relations)
case params[:category] case params[:category]
when 'study' then when 'study', 'collect' then
study_shixun_status_filter(relations) study_shixun_status_filter(relations)
when 'manage' then when 'manage' then
manage_shixun_status_filter(relations) manage_shixun_status_filter(relations)
@ -97,7 +99,7 @@ class Users::ShixunService
end end
case params[:category] case params[:category]
when 'study' then when 'study', 'collect' then
relations.order("myshixuns.#{sort_by} #{sort_direction}") relations.order("myshixuns.#{sort_by} #{sort_direction}")
when 'manage' then when 'manage' then
relations.order("shixuns.#{sort_by} #{sort_direction}") relations.order("shixuns.#{sort_by} #{sort_direction}")

@ -25,10 +25,13 @@ class Users::SubjectService
Subject.joins(stage_shixuns: { shixun: :myshixuns }).where(myshixuns: { user_id: user.id }) Subject.joins(stage_shixuns: { shixun: :myshixuns }).where(myshixuns: { user_id: user.id })
when 'manage' then when 'manage' then
Subject.joins(:subject_members).where(subject_members: { user_id: user.id }) Subject.joins(:subject_members).where(subject_members: { user_id: user.id })
when 'collect' then
Subject.where(id: user.subject_collections.pluck(:container_id))
else else
study_subject_ids = StageShixun.where(shixun_id: user.myshixuns.pluck(:shixun_id)).pluck(:subject_id) study_subject_ids = StageShixun.where(shixun_id: user.myshixuns.pluck(:shixun_id)).pluck(:subject_id)
manage_subject_ids = user.subject_members.pluck(:subject_id) manage_subject_ids = user.subject_members.pluck(:subject_id)
Subject.where(id: study_subject_ids + manage_subject_ids) collect_subject_ids = user.subject_collections.pluck(:container_id)
Subject.where(id: study_subject_ids + manage_subject_ids + collect_subject_ids)
end end
end end
@ -45,7 +48,7 @@ class Users::SubjectService
return relations unless self_or_admin? return relations unless self_or_admin?
case params[:category] case params[:category]
when 'study' then when 'study', 'collect' then
study_subject_status_filter(relations) study_subject_status_filter(relations)
when 'manage' then when 'manage' then
manage_subject_status_filter(relations) manage_subject_status_filter(relations)

@ -11,7 +11,9 @@ json.attendances @attendances do |attendance|
json.edit_auth @user_course_identity < Course::PROFESSOR || attendance.user_id == User.current.id json.edit_auth @user_course_identity < Course::PROFESSOR || attendance.user_id == User.current.id
if @user_course_identity == Course::STUDENT if @user_course_identity == Course::STUDENT
json.attendance_status student_attendance_status(attendance, User.current) student_attendance_status = student_attendance_status(attendance, User.current)
json.attendance_status student_attendance_status[:attendance_status]
json.attendance_mode student_attendance_status[:attendance_mode]
end end
end end

@ -1,5 +1,7 @@
json.fork_from @fork_from json.fork_from @fork_from
json.identity User.current.shixun_identity(@shixun) json.identity User.current.shixun_identity(@shixun)
json.is_collect User.current&.is_collect?(@shixun)
json.power @power json.power @power
json.partial! 'shixuns/top', locals: { shixun: @shixun, current_myshixun: @current_myshixun } json.partial! 'shixuns/top', locals: { shixun: @shixun, current_myshixun: @current_myshixun }
json.secret_repository @shixun.shixun_secret_repository.present? json.secret_repository @shixun.shixun_secret_repository.present?

@ -5,6 +5,8 @@ json.challenges_count @subject.subject_challenge_count
json.subject_score @subject.all_score json.subject_score @subject.all_score
json.member_count @subject.member_count json.member_count @subject.member_count
json.is_collect @user&.is_collect?(@subject)
json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin? json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin?
json.publish_status publish_status(@subject, @is_manager) json.publish_status publish_status(@subject, @is_manager)
json.public_status public_status(@subject, @is_manager, @user) json.public_status public_status(@subject, @is_manager, @user)

@ -2,4 +2,7 @@ json.(attendance, :id, :name, :mode)
json.attendance_date attendance.attendance_date.strftime("%Y/%m/%d") json.attendance_date attendance.attendance_date.strftime("%Y/%m/%d")
json.start_time attendance.start_time.strftime("%H:%M") json.start_time attendance.start_time.strftime("%H:%M")
json.end_time attendance.end_time.strftime("%H:%M") json.end_time attendance.end_time.strftime("%H:%M")
json.attendance_status student_attendance_status(attendance, User.current)
student_attendance_status = student_attendance_status(attendance, User.current)
json.attendance_status student_attendance_status[:attendance_status]
json.attendance_mode student_attendance_status[:attendance_mode]

@ -306,6 +306,10 @@ Rails.application.routes.draw do
resources :subject_lists resources :subject_lists
resources :shixun_lists resources :shixun_lists
resources :collections do
delete :cancel, on: :collection
end
resources :shixuns, param: :identifier do resources :shixuns, param: :identifier do
collection do collection do

@ -0,0 +1,13 @@
class CreateCollections < ActiveRecord::Migration[5.2]
def change
create_table :collections do |t|
t.references :user, index: true
t.integer :container_id
t.string :container_type
t.timestamps
end
add_index :collections, [:container_type, :container_id]
end
end

@ -0,0 +1,6 @@
class UniqIndexOnCollections < ActiveRecord::Migration[5.2]
def change
remove_index :collections, [:container_type, :container_id]
add_index :collections, [:container_type, :container_id], unique: true
end
end

@ -110,7 +110,7 @@ export function configShareForCourses () {
var shareData = { var shareData = {
title: 'EduCoder - 教学课堂', title: 'EduCoder - 教学课堂',
desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。', desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。',
link: `${host}/courses`, link: `${host}/classrooms`,
imgUrl: window.__testImageUrl imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg' || host + '/react/build/images/share_logo_icon.jpg'
}; };

@ -2763,7 +2763,7 @@ class PollNewQuestbank extends Component {
// //
// let courseId=this.props.match.params.coursesId; // let courseId=this.props.match.params.coursesId;
// if(courseId===undefined){ // if(courseId===undefined){
// this.props.history.push("/courses"); // this.props.history.push("/classrooms");
// }else{ // }else{
// this.props.history.push(this.props.current_user.first_category_url); // this.props.history.push(this.props.current_user.first_category_url);
// } // }

@ -125,6 +125,15 @@ class Teacherentry extends Component {
</div> </div>
</div> </div>
<style>
{
`
.initials{
cursor: initial !important;
}
`
}
</style>
<div className="ws20s sortinxdirection"> <div className="ws20s sortinxdirection">
{ {
isAdmin === true ? isAdmin === true ?
@ -154,13 +163,16 @@ class Teacherentry extends Component {
{ {
item.attendance_status? item.attendance_status?
( (
item.attendance_status==="ABSENCE"? item.attendance_status==="ABSENCE"&&item.attendance_mode!="TEACHER"?
<div className="qiandaobutton xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.Signin(item.mode,item.id,item.attendance_code)}}> <div className="qiandaobutton xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.Signin(item.mode,item.id,item.attendance_code)}}>
签到 签到
</div> </div>
: : item.attendance_status === "LEAVE" ?
item.attendance_status==="NORMAL"? <div className="qjqiandao initials">
<div className="qiandaobutton" > 请假
</div>
: item.attendance_status==="NORMAL"?
<div className="zcqiandao initials">
正常签到 正常签到
</div> </div>
:"" :""
@ -175,15 +187,15 @@ class Teacherentry extends Component {
{ {
item.attendance_status? item.attendance_status?
item.attendance_status === "NORMAL" ? item.attendance_status === "NORMAL" ?
<div className="zcqiandao xiaoshou"> <div className="zcqiandao initials">
正常签到 正常签到
</div> </div>
: item.attendance_status === "LEAVE" ? : item.attendance_status === "LEAVE" ?
<div className="qjqiandao xiaoshou"> <div className="qjqiandao initials">
请假 请假
</div> </div>
: item.attendance_status === "ABSENCE" ? : item.attendance_status === "ABSENCE" ?
<div className="kkqiandao xiaoshou"> <div className="kkqiandao initials">
旷课 旷课
</div> </div>
: :

@ -272,13 +272,13 @@ class MessagSub extends Component {
return window.open(`/forums/`); return window.open(`/forums/`);
case "Watcher" : case "Watcher" :
// 用户个人中心页 :id = item.trigger_user.login // 用户个人中心页 :id = item.trigger_user.login
return window.open(`/users/${item.trigger_user.login}/courses`) return window.open(`/users/${item.trigger_user.login}/classrooms`)
case "PraiseTread" : case "PraiseTread" :
// 这块太复杂 不好处理 // 这块太复杂 不好处理
return ''; return '';
case "Grade" : case "Grade" :
//个人中心页 :id = item.trigger_user.login //个人中心页 :id = item.trigger_user.login
// return window.open(`/users/${item.trigger_user.login}/courses`; // return window.open(`/users/${item.trigger_user.login}/classrooms`;
return ""; return "";
case "JoinProject" : case "JoinProject" :
//项目详情-申请加入项目审核页 :id = container_id //项目详情-申请加入项目审核页 :id = container_id

@ -1123,15 +1123,15 @@ class NewHeader extends Component {
<a href={"/register"} className="mr5 color-white">注册</a> <a href={"/register"} className="mr5 color-white">注册</a>
</span> : </span> :
<div className="fr edu-menu-panel mr25" style={{ height: '60px' }}> <div className="fr edu-menu-panel mr25" style={{ height: '60px' }}>
<a href={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/courses`} className="fl ml15"> <a href={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/classrooms`} className="fl ml15">
<img alt="头像" className="radius mt13" height="34" id="nh_user_logo" name="avatar_image" <img alt="头像" className="radius mt13" height="34" id="nh_user_logo" name="avatar_image"
src={getImageUrl(`images/` + user.image_url)} width="34"> src={getImageUrl(`images/` + user.image_url)} width="34">
</img> </img>
</a> </a>
<ul className="edu-menu-list" style={{ top: '60px' }}> <ul className="edu-menu-list" style={{ top: '60px' }}>
{/*<span className="bor-bottom-greyE currentName task-hide">{user.username}</span>*/} {/*<span className="bor-bottom-greyE currentName task-hide">{user.username}</span>*/}
<li><Link to={`/users/${this.props.current_user.login}/courses`}>我的个人主页</Link></li> <li><Link to={`/users/${this.props.current_user.login}/classrooms`}>我的个人主页</Link></li>
{coursestypes === true ? "" : <li><Link to={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/courses`}>{this.props.user && this.props.user.main_site === false ? "我的课堂" : "我的教学课堂"}</Link></li>} {coursestypes === true ? "" : <li><Link to={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/classrooms`}>{this.props.user && this.props.user.main_site === false ? "我的课堂" : "我的教学课堂"}</Link></li>}
{/* p 老师 l 学生 */} {/* p 老师 l 学生 */}
{shixuntype === true ? "" : <li><Link to={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/shixuns`}>我的实训项目</Link></li>} {shixuntype === true ? "" : <li><Link to={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/shixuns`}>我的实训项目</Link></li>}
{pathstype === true ? "" : <li><Link to={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/paths`}>{this.props.user && this.props.user.main_site === false ? "我的课程" : "我的实践课程"}</Link></li>} {pathstype === true ? "" : <li><Link to={`/users/${this.props.current_user === undefined ? "" : this.props.current_user.login}/paths`}>{this.props.user && this.props.user.main_site === false ? "我的课程" : "我的实践课程"}</Link></li>}

@ -86,7 +86,7 @@ class TPMRightSection extends Component {
<p className="font-16 mb20"><i className={"iconfont icon-chuangjianzhe1 audit_situationactive font-14"}></i> </p> <p className="font-16 mb20"><i className={"iconfont icon-chuangjianzhe1 audit_situationactive font-14"}></i> </p>
<div className="df"> <div className="df">
<a <a
href={TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : `/users/${TPMRightSectionData.creator.login}/courses`}> href={TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : `/users/${TPMRightSectionData.creator.login}/classrooms`}>
<img alt="头像" className="radius mr10" height="36" <img alt="头像" className="radius mr10" height="36"
src={getImageUrl(TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : 'images/' + TPMRightSectionData.creator.image_url + "?1532489442")} src={getImageUrl(TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : 'images/' + TPMRightSectionData.creator.image_url + "?1532489442")}
width="36"/> width="36"/>

@ -274,7 +274,7 @@ class Infos extends Component{
{/* 课堂 */} {/* 课堂 */}
{/* http://localhost:3007/courses/1309/homework/9300/setting */} {/* http://localhost:3007/courses/1309/homework/9300/setting */}
<Route exact path="/users/:username/courses" <Route exact path="/users/:username/classrooms"
render={ render={
(props) => (<InfosCourse {...this.props} {...props} {...this.state} {..._commonProps}/>) (props) => (<InfosCourse {...this.props} {...props} {...this.state} {..._commonProps}/>)
} }

@ -120,7 +120,7 @@ class InfosBanner extends Component{
{coursestypes===true?"":<li className={`${moduleName == 'classrooms' ||moduleName == undefined ? 'active' : '' }`}> {coursestypes===true?"":<li className={`${moduleName == 'classrooms' ||moduleName == undefined ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'classrooms'})} onClick={() => this.setState({moduleName: 'classrooms'})}
to={`/users/${username}/courses`}>教学课堂</Link> to={`/users/${username}/classrooms`}>教学课堂</Link>
</li>} </li>}
{shixuntype===true?"":<li className={`${moduleName == 'shixuns' ? 'active' : '' }`}> {shixuntype===true?"":<li className={`${moduleName == 'shixuns' ? 'active' : '' }`}>
<Link <Link

@ -153,7 +153,7 @@ class banner_out extends Component{
<li className={`${moduleName == 'classrooms' ||moduleName == undefined ? 'active' : '' }`}> <li className={`${moduleName == 'classrooms' ||moduleName == undefined ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'classrooms'})} onClick={() => this.setState({moduleName: 'classrooms'})}
to={`/users/${username}/courses`}>课堂</Link> to={`/users/${username}/classrooms`}>课堂</Link>
</li> </li>
<li className={`${moduleName == 'shixuns' ? 'active' : '' }`}> <li className={`${moduleName == 'shixuns' ? 'active' : '' }`}>
<Link <Link

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Collection, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save