From 72511c30cb09e11dda16b65dffaa903e3b5efc70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Wed, 25 Sep 2019 17:51:26 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../exercise/Studentshavecompletedthelist.js | 32 +++++++++----------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js
index 6fdde6aeb..aef18ef5d 100644
--- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js
+++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js
@@ -1278,19 +1278,19 @@ class Studentshavecompletedthelist extends Component {
}catch (e) {
}
- try {
- if(this.props.Commonheadofthetestpaper.exercise_status !== undefined){
- this.setState({
- exercise_status:this.props.Commonheadofthetestpaper.exercise_status,
- })
- }else{
- this.setState({
- exercise_status:0,
- })
- }
- }catch (e) {
-
- }
+ // try {
+ // if(this.props.Commonheadofthetestpaper.exercise_status !== undefined){
+ // this.setState({
+ // exercise_status:this.props.Commonheadofthetestpaper.exercise_status,
+ // })
+ // }else{
+ // this.setState({
+ // exercise_status:0,
+ // })
+ // }
+ // }catch (e) {
+ //
+ // }
}
@@ -2499,7 +2499,7 @@ class Studentshavecompletedthelist extends Component {
}}>
{/*老师*/}
{
- exercise_status===0 || exercise_status===1 ?
+ this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status===0 || this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status===1 ?
@@ -2716,7 +2716,7 @@ class Studentshavecompletedthelist extends Component {
{
- exercise_status === 0 || exercise_status === 1 ?
+ this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status === 0 || this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status === 1 ?
@@ -2797,7 +2797,7 @@ class Studentshavecompletedthelist extends Component {
" min-width": " 1200px"
}}>
{
- exercise_status === 0 || exercise_status === 1 ?
+ this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status === 0 || this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status === 1 ?
From 896485b41aea6f000b6011da2645ef1658ebbb02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Wed, 25 Sep 2019 17:52:19 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../exercise/Studentshavecompletedthelist.js | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js
index aef18ef5d..610ac5793 100644
--- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js
+++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js
@@ -1278,20 +1278,6 @@ class Studentshavecompletedthelist extends Component {
}catch (e) {
}
- // try {
- // if(this.props.Commonheadofthetestpaper.exercise_status !== undefined){
- // this.setState({
- // exercise_status:this.props.Commonheadofthetestpaper.exercise_status,
- // })
- // }else{
- // this.setState({
- // exercise_status:0,
- // })
- // }
- // }catch (e) {
- //
- // }
-
}
componentWillReceiveProps = (nextProps) => {
From 82d80edacae192930c098607ef973bc4050676e9 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Thu, 26 Sep 2019 10:53:55 +0800
Subject: [PATCH 3/3] add library tag && library tag list api
---
app/controllers/library_tags_controller.rb | 6 ++++++
config/routes.rb | 1 +
db/migrate/20190926024819_add_library_tag_data.rb | 9 +++++++++
3 files changed, 16 insertions(+)
create mode 100644 app/controllers/library_tags_controller.rb
create mode 100644 db/migrate/20190926024819_add_library_tag_data.rb
diff --git a/app/controllers/library_tags_controller.rb b/app/controllers/library_tags_controller.rb
new file mode 100644
index 000000000..0b11027a5
--- /dev/null
+++ b/app/controllers/library_tags_controller.rb
@@ -0,0 +1,6 @@
+class LibraryTagsController < ApplicationController
+ def index
+ library_tags = LibraryTag.all
+ render_ok(library_tags: library_tags.as_json(only: %i[id name]), count: library_tags.size)
+ end
+end
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index af7e0ee3b..f111d4894 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -791,6 +791,7 @@ Rails.application.routes.draw do
end
resources :libraries, only: [:index, :show, :create, :update, :destroy]
+ resources :library_tags, only: [:index]
scope module: :projects do
resources :project_applies, only: [:create]
diff --git a/db/migrate/20190926024819_add_library_tag_data.rb b/db/migrate/20190926024819_add_library_tag_data.rb
new file mode 100644
index 000000000..b2b40bbf5
--- /dev/null
+++ b/db/migrate/20190926024819_add_library_tag_data.rb
@@ -0,0 +1,9 @@
+class AddLibraryTagData < ActiveRecord::Migration[5.2]
+ def up
+ execute 'INSERT INTO library_tags(id, name) VALUES(4, "高校案例")'
+ end
+
+ def down
+ execute 'DELETE FROM library_tags WHERE id = 4 and name = "高校案例"'
+ end
+end