Merge branches 'dev_aliyun' and 'new_shixuns_repository' of https://bdgit.educoder.net/Hjqreturn/educoder into new_shixuns_repository
commit
482f983c4d
@ -0,0 +1,20 @@
|
||||
# 作业的一键评阅
|
||||
class HomeworkBatchCommentJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(comment, hidden_comment, work_ids, homework_id, user_id)
|
||||
# Do something later
|
||||
homework = HomeworkCommon.find_by(id: homework_id)
|
||||
return if homework.blank?
|
||||
|
||||
attrs = %i[student_work_id challenge_id user_id comment hidden_comment batch_comment created_at updated_at]
|
||||
|
||||
same_attrs = {challenge_id: 0, user_id: user_id, comment: comment, hidden_comment: hidden_comment, batch_comment: 1}
|
||||
|
||||
ShixunWorkComment.bulk_insert(*attrs) do |worker|
|
||||
work_ids.each do |work_id|
|
||||
worker.add same_attrs.merge(student_work_id: work_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddBatchCommentToShixunWork < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :shixun_work_comments, :batch_comment, :boolean, default: 0
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 374 KiB After Width: | Height: | Size: 375 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,129 +1,135 @@
|
||||
import React,{ Component } from "react";
|
||||
|
||||
import {
|
||||
Form, Input, InputNumber, Switch, Radio,
|
||||
Slider, Button, Upload, Icon, Rate, Checkbox, message,
|
||||
Row, Col, Select, Modal, Tooltip
|
||||
} from 'antd';
|
||||
import axios from 'axios'
|
||||
import QestionDisplayHeader from './QestionDisplayHeader'
|
||||
import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder';
|
||||
const { TextArea } = Input;
|
||||
const confirm = Modal.confirm;
|
||||
const $ = window.$
|
||||
const { Option } = Select;
|
||||
|
||||
const tagArray = [
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
|
||||
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
|
||||
]
|
||||
const qNameArray = [
|
||||
'单选题',
|
||||
'多选题',
|
||||
'判断题',
|
||||
'填空题',
|
||||
'简答题',
|
||||
'实训题',
|
||||
]
|
||||
class SingleDisplay extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
|
||||
|
||||
this.state = {
|
||||
question_choices: ['', '', '', ''],
|
||||
standard_answers: [false, false, false, false]
|
||||
}
|
||||
}
|
||||
componentDidMount = () => {
|
||||
const Id = this.props.match.params.Id
|
||||
this.isEdit = !!Id
|
||||
if (Id) {
|
||||
const url = `/exercises/${Id}/edit.json`
|
||||
// axios.get(url)
|
||||
// .then((response) => {
|
||||
// if (response.data.status == 0) {
|
||||
|
||||
// }
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log(error);
|
||||
// });
|
||||
}
|
||||
}
|
||||
render() {
|
||||
let { question_title, question_score, question_type, question_choices, standard_answer,
|
||||
question_id, question_number, index, displayCount, showActionButton
|
||||
} = this.props;
|
||||
|
||||
// const { getFieldDecorator } = this.props.form;
|
||||
|
||||
const isAdmin = this.props.isAdmin()
|
||||
const courseId=this.props.match.params.coursesId;
|
||||
const isEdit = this.isEdit
|
||||
const qNumber = `question_${index}`;
|
||||
// TODO show模式 isNew为false isEdit为false
|
||||
|
||||
// [true, false, true] -> [0, 2]
|
||||
|
||||
// const answerTagArray = standard_answer.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
|
||||
let length = 5;
|
||||
const qName = qNameArray[question_type]
|
||||
|
||||
const isPreviewPage = showActionButton == false
|
||||
|
||||
return(
|
||||
<div className="bor-bottom-greyE padding20-30 singleDisplay" id={qNumber} _id={question_id}>
|
||||
<style>{`
|
||||
.optionMdEditor {
|
||||
flex: 0 0 800px
|
||||
}
|
||||
.optionRow {
|
||||
margin: 2px;
|
||||
}
|
||||
.actionBtns {
|
||||
height: 28px
|
||||
}
|
||||
`}</style>
|
||||
|
||||
<QestionDisplayHeader {...this.props}></QestionDisplayHeader>
|
||||
|
||||
{/* 单选 or 多选 */}
|
||||
<div className="options">
|
||||
{ question_choices.map((item, optionIndex) => {
|
||||
let prefix = undefined
|
||||
// if (!isPreviewPage) {
|
||||
prefix = `${tagArray[optionIndex]}.`
|
||||
// }
|
||||
if (question_type == 0) { // 单选
|
||||
return (
|
||||
<div className="mb10 clearfix" key={optionIndex}>
|
||||
<Radio disabled className="fl lineh-25" checked={item.standard_boolean}>{prefix}</Radio>
|
||||
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1) + '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
|
||||
|
||||
></MarkdownToHtml>
|
||||
{/* <span style={{ display: 'inline-block'}} className="markdown-body fl"
|
||||
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
|
||||
</div>)
|
||||
} else {
|
||||
|
||||
return (
|
||||
<div className="mb10 clearfix" key={optionIndex}>
|
||||
<Checkbox disabled className="fl lineh-25 mr8" checked={item.standard_boolean}>{prefix}</Checkbox>
|
||||
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1)+ '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
|
||||
|
||||
></MarkdownToHtml>
|
||||
{/* <span style={{ display: 'inline-block'}} className="markdown-body fl"
|
||||
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
|
||||
</div>)
|
||||
}
|
||||
})}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
// RouteHOC()
|
||||
export default (SingleDisplay);
|
||||
import React,{ Component } from "react";
|
||||
|
||||
import {
|
||||
Form, Input, InputNumber, Switch, Radio,
|
||||
Slider, Button, Upload, Icon, Rate, Checkbox, message,
|
||||
Row, Col, Select, Modal, Tooltip
|
||||
} from 'antd';
|
||||
import axios from 'axios'
|
||||
import QestionDisplayHeader from './QestionDisplayHeader'
|
||||
import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder';
|
||||
const { TextArea } = Input;
|
||||
const confirm = Modal.confirm;
|
||||
const $ = window.$
|
||||
const { Option } = Select;
|
||||
|
||||
const tagArray = [
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
|
||||
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
|
||||
]
|
||||
const qNameArray = [
|
||||
'单选题',
|
||||
'多选题',
|
||||
'判断题',
|
||||
'填空题',
|
||||
'简答题',
|
||||
'实训题',
|
||||
]
|
||||
class SingleDisplay extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
|
||||
|
||||
this.state = {
|
||||
question_choices: ['', '', '', ''],
|
||||
standard_answers: [false, false, false, false]
|
||||
}
|
||||
}
|
||||
componentDidMount = () => {
|
||||
const Id = this.props.match.params.Id
|
||||
this.isEdit = !!Id
|
||||
if (Id) {
|
||||
const url = `/exercises/${Id}/edit.json`
|
||||
// axios.get(url)
|
||||
// .then((response) => {
|
||||
// if (response.data.status == 0) {
|
||||
|
||||
// }
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log(error);
|
||||
// });
|
||||
}
|
||||
}
|
||||
render() {
|
||||
let { question_title, question_score, question_type, question_choices, standard_answer,
|
||||
question_id, question_number, index, displayCount, showActionButton
|
||||
} = this.props;
|
||||
|
||||
// const { getFieldDecorator } = this.props.form;
|
||||
|
||||
const isAdmin = this.props.isAdmin()
|
||||
const courseId=this.props.match.params.coursesId;
|
||||
const isEdit = this.isEdit
|
||||
const qNumber = `question_${index}`;
|
||||
// TODO show模式 isNew为false isEdit为false
|
||||
|
||||
// [true, false, true] -> [0, 2]
|
||||
|
||||
// const answerTagArray = standard_answer.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
|
||||
let length = 5;
|
||||
const qName = qNameArray[question_type]
|
||||
|
||||
const isPreviewPage = showActionButton == false
|
||||
|
||||
return(
|
||||
<div className="bor-bottom-greyE padding20-30 singleDisplay" id={qNumber} _id={question_id}>
|
||||
<style>{`
|
||||
.optionMdEditor {
|
||||
flex: 0 0 800px
|
||||
}
|
||||
.optionRow {
|
||||
margin: 2px;
|
||||
}
|
||||
.actionBtns {
|
||||
height: 28px
|
||||
}
|
||||
`}</style>
|
||||
|
||||
<QestionDisplayHeader {...this.props}></QestionDisplayHeader>
|
||||
|
||||
{/* 单选 or 多选 */}
|
||||
<div className="options">
|
||||
{ question_choices.map((item, optionIndex) => {
|
||||
let prefix = undefined
|
||||
// if (!isPreviewPage) {
|
||||
prefix = `${tagArray[optionIndex]}.`
|
||||
// }
|
||||
if (question_type == 0) { // 单选
|
||||
return (
|
||||
<div className="mb10 clearfix " style={{
|
||||
display: "flex",
|
||||
flexDirection:"row",
|
||||
}} key={optionIndex}>
|
||||
<Radio disabled className="fl lineh-25" checked={item.standard_boolean}>{prefix}</Radio>
|
||||
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1) + '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
|
||||
|
||||
></MarkdownToHtml>
|
||||
{/* <span style={{ display: 'inline-block'}} className="markdown-body fl"
|
||||
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
|
||||
</div>)
|
||||
} else {
|
||||
|
||||
return (
|
||||
<div className="mb10 clearfix" style={{
|
||||
display: "flex",
|
||||
flexDirection:"row",
|
||||
}} key={optionIndex}>
|
||||
<Checkbox disabled className="fl lineh-25 mr8" checked={item.standard_boolean}>{prefix}</Checkbox>
|
||||
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1)+ '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
|
||||
|
||||
></MarkdownToHtml>
|
||||
{/* <span style={{ display: 'inline-block'}} className="markdown-body fl"
|
||||
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
|
||||
</div>)
|
||||
}
|
||||
})}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
// RouteHOC()
|
||||
export default (SingleDisplay);
|
||||
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe HomeworkBatchCommentJob, type: :job do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in new issue