Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PM2-FE
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Veronika Ovsyannikova
PM2-FE
Commits
0e36c5ec
Commit
0e36c5ec
authored
1 year ago
by
Iurii Lebedev
Browse files
Options
Downloads
Patches
Plain Diff
initial point count in quiz fix
parent
09711fe5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/AddQuizForm.js
+4
-4
4 additions, 4 deletions
src/components/AddQuizForm.js
src/models/updQuiz.js
+1
-2
1 addition, 2 deletions
src/models/updQuiz.js
with
5 additions
and
6 deletions
src/components/AddQuizForm.js
+
4
−
4
View file @
0e36c5ec
...
@@ -6,7 +6,7 @@ import QuizService from "../service/quiz.service";
...
@@ -6,7 +6,7 @@ import QuizService from "../service/quiz.service";
import
{
AddQuiz
}
from
"
../models/addQuiz
"
;
import
{
AddQuiz
}
from
"
../models/addQuiz
"
;
import
{
Context
}
from
"
../index
"
;
import
{
Context
}
from
"
../index
"
;
import
{
useHistory
}
from
"
react-router-dom/cjs/react-router-dom
"
;
import
{
useHistory
}
from
"
react-router-dom/cjs/react-router-dom
"
;
import
{
MAIN_ROUTE
,
TEXT
}
from
"
../utils/consts
"
;
import
{
MAIN_ROUTE
,
MULTIPLE_RIGHT
,
SINGLE_RIGHT
,
TEXT
}
from
"
../utils/consts
"
;
import
{
useParams
}
from
"
react-router-dom
"
;
import
{
useParams
}
from
"
react-router-dom
"
;
import
{
updateQuiz
}
from
"
../models/updQuiz
"
;
import
{
updateQuiz
}
from
"
../models/updQuiz
"
;
...
@@ -17,10 +17,10 @@ export const AddQuizForm = observer(() => {
...
@@ -17,10 +17,10 @@ export const AddQuizForm = observer(() => {
const
{
id
}
=
useParams
();
const
{
id
}
=
useParams
();
const
[
errMsg
,
setErrMsg
]
=
useState
(
''
)
const
[
errMsg
,
setErrMsg
]
=
useState
(
''
)
const
[
quizName
,
setQuizName
]
=
useState
(
''
);
const
[
quizName
,
setQuizName
]
=
useState
(
''
);
const
[
questionCount
,
setQuestionCount
]
=
useState
(
0
)
const
[
questionCount
,
setQuestionCount
]
=
useState
(
0
)
const
[
questions
,
setQuestions
]
=
useState
([])
const
[
questions
,
setQuestions
]
=
useState
([])
const
publish
=
()
=>
{
const
publish
=
()
=>
{
if
(
id
===
undefined
)
{
if
(
id
===
undefined
)
{
QuizService
.
create
(
new
AddQuiz
(
quizName
,
questions
),
user
.
token
).
then
(
r
=>
{
QuizService
.
create
(
new
AddQuiz
(
quizName
,
questions
),
user
.
token
).
then
(
r
=>
{
...
@@ -32,7 +32,7 @@ export const AddQuizForm = observer(() => {
...
@@ -32,7 +32,7 @@ export const AddQuizForm = observer(() => {
}
}
})
})
}
else
{
}
else
{
QuizService
.
update
(
new
updateQuiz
(
quiz
.
id
,
quizName
,
user
.
id
,
questions
),
user
.
token
).
then
(
r
=>
{
QuizService
.
update
(
new
updateQuiz
(
quiz
.
id
,
quizName
,
questions
),
user
.
token
).
then
(
r
=>
{
try
{
try
{
console
.
log
(
'
Quiz created by
'
+
user
.
username
);
console
.
log
(
'
Quiz created by
'
+
user
.
username
);
history
.
push
(
MAIN_ROUTE
);
history
.
push
(
MAIN_ROUTE
);
...
@@ -47,7 +47,7 @@ export const AddQuizForm = observer(() => {
...
@@ -47,7 +47,7 @@ export const AddQuizForm = observer(() => {
setQuestions
(
prevState
=>
[...
prevState
,
{
setQuestions
(
prevState
=>
[...
prevState
,
{
type
:
null
,
type
:
null
,
text
:
''
,
text
:
''
,
points
:
0
,
points
:
1
,
answerOptions
:
[]
answerOptions
:
[]
}])
}])
setQuestionCount
(
prevState
=>
prevState
+
1
);
setQuestionCount
(
prevState
=>
prevState
+
1
);
...
...
This diff is collapsed.
Click to expand it.
src/models/updQuiz.js
+
1
−
2
View file @
0e36c5ec
export
class
updateQuiz
{
export
class
updateQuiz
{
constructor
(
id
,
name
,
authorId
,
questions
)
{
constructor
(
id
,
name
,
questions
)
{
this
.
id
=
id
this
.
id
=
id
this
.
name
=
name
this
.
name
=
name
this
.
authorId
=
authorId
this
.
questions
=
questions
this
.
questions
=
questions
}
}
}
}
\ No newline at end of file
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