Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
zesje
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Réouven ASSOULY
zesje
Commits
536ba8b7
Commit
536ba8b7
authored
6 years ago
by
Thomas Roos
Browse files
Options
Downloads
Patches
Plain Diff
Improve updates of specific submissions
parent
1ad1fd0e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/index.jsx
+30
-14
30 additions, 14 deletions
client/index.jsx
with
30 additions
and
14 deletions
client/index.jsx
+
30
−
14
View file @
536ba8b7
...
...
@@ -70,18 +70,7 @@ class App extends React.Component {
}))
}
updateSubmission
=
(
index
,
sub
)
=>
{
if
(
index
!=
undefined
)
{
if
(
sub
)
{
let
newList
=
this
.
state
.
exam
.
submissions
;
newList
[
index
]
=
sub
;
this
.
setState
({
exam
:
{
...
this
.
state
.
exam
,
submissions
:
newList
}
})
}
}
else
{
if
(
index
==
undefined
)
{
api
.
get
(
'
submissions/
'
+
this
.
state
.
exam
.
id
)
.
then
(
subs
=>
this
.
setState
({
exam
:
{
...
...
@@ -89,6 +78,33 @@ class App extends React.Component {
submissions
:
subs
}
}))
}
else
{
if
(
sub
)
{
if
(
JSON
.
stringify
(
sub
)
!=
JSON
.
stringify
(
this
.
state
.
exam
.
submissions
[
index
]))
{
let
newList
=
this
.
state
.
exam
.
submissions
;
newList
[
index
]
=
sub
;
this
.
setState
({
exam
:
{
...
this
.
state
.
exam
,
submissions
:
newList
}
})
}
}
else
{
api
.
get
(
'
submissions/
'
+
this
.
state
.
exam
.
id
+
'
/
'
+
this
.
state
.
exam
.
submissions
[
index
].
id
)
.
then
(
sub
=>
{
if
(
JSON
.
stringify
(
sub
)
!=
JSON
.
stringify
(
this
.
state
.
exam
.
submissions
[
index
]))
{
let
newList
=
this
.
state
.
exam
.
submissions
;
newList
[
index
]
=
sub
;
this
.
setState
({
exam
:
{
...
this
.
state
.
exam
,
submissions
:
newList
}
})
}
})
}
}
}
...
...
@@ -109,10 +125,10 @@ class App extends React.Component {
<
Route
path
=
"/students"
render
=
{
()
=>
<
Students
exam
=
{
exam
}
updateSubmission
=
{
this
.
updateSubmission
}
/>
}
/>
<
Route
path
=
"/grade"
render
=
{
()
=>
(
exam
&&
exam
.
submissions
?
<
Grade
exam
=
{
exam
}
/>
:
<
Fail
message
=
"No exams uploaded. Please do not bookmark URLs"
/>
exam
.
submissions
.
length
?
<
Grade
exam
=
{
exam
}
updateSubmission
=
{
this
.
updateSubmission
}
/>
:
<
Fail
message
=
"No exams uploaded. Please do not bookmark URLs"
/>
)
}
/>
<
Route
path
=
"/statistics"
render
=
{
()
=>
(
exam
&&
exam
.
submissions
?
<
Statistics
/>
:
<
Fail
message
=
"No exams uploaded. Please do not bookmark URLs"
/>
exam
.
submissions
.
length
?
<
Statistics
/>
:
<
Fail
message
=
"No exams uploaded. Please do not bookmark URLs"
/>
)
}
/>
<
Route
path
=
"/graders"
component
=
{
Graders
}
/>
<
Route
path
=
"/reset"
component
=
{
Reset
}
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment