Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nextcloud-forms
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
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
Milan Jaros
nextcloud-forms
Commits
ab841ffa
Commit
ab841ffa
authored
3 years ago
by
Milan Jaros
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
3f1af8bc
No related branches found
No related tags found
1 merge request
!1
Ncc v2.2.4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/views/Submit.vue
+28
-31
28 additions, 31 deletions
src/views/Submit.vue
with
28 additions
and
31 deletions
src/views/Submit.vue
+
28
−
31
View file @
ab841ffa
...
@@ -227,25 +227,30 @@ export default {
...
@@ -227,25 +227,30 @@ export default {
this
.
$refs
.
submitButton
.
click
()
this
.
$refs
.
submitButton
.
click
()
}
,
}
,
checkQuestion
(
indexQ
)
{
checkQuestion
(
indexQ
,
saveIndex
)
{
const
question
=
this
.
form
.
questions
[
indexQ
]
const
question
=
this
.
form
.
questions
[
indexQ
]
const
qTextSplit1
=
question
.
text
.
replace
(
'
[n]
'
,
''
).
replace
(
'
]
'
,
''
).
split
(
'
[
'
)
// [1/1]
const
qTextSplit1
=
question
.
text
.
replace
(
'
[n]
'
,
''
).
replace
(
'
]
'
,
''
).
split
(
'
[
'
)
// [1/1]
[1/2][1/3]
if
(
qTextSplit1
.
length
>
1
)
{
if
(
qTextSplit1
.
length
>
1
)
{
let
i
let
i
for
(
i
=
0
;
i
<
qTextSplit1
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
qTextSplit1
.
length
;
i
++
)
{
const
qTextSplit2
=
qTextSplit1
[
i
].
split
(
'
/
'
)
//
1/1]
const
qTextSplit2
=
qTextSplit1
[
i
].
split
(
'
/
'
)
//
(1,1) (1,2) (1,3)
if
(
qTextSplit2
.
length
>
1
)
{
if
(
qTextSplit2
.
length
>
1
)
{
const
qi
=
parseInt
(
qTextSplit2
[
0
])
const
qi
=
parseInt
(
qTextSplit2
[
0
])
// 1 1 1
const
ai
=
parseInt
(
qTextSplit2
[
1
])
const
ai
=
parseInt
(
qTextSplit2
[
1
])
// 1 2 3
if
(
this
.
answers
[
qi
])
{
if
(
this
.
answers
[
qi
])
{
// "q1": None
const
answers
=
this
.
answers
[
qi
].
filter
(
answer
=>
answer
===
ai
)
const
answers
=
this
.
answers
[
qi
].
filter
(
answer
=>
answer
===
ai
)
// "q1" : [a1,a2,a3,a4]
if
(
!
answers
.
length
)
{
if
(
!
answers
.
length
)
{
continue
// no answers, go to next question
continue
// no answers, go to next question
}
else
{
}
else
{
return
true
return
true
}
}
}
else
{
if
(
saveIndex
)
{
showError
(
t
(
'
forms
'
,
'
Answer is required
'
))
throw
'
Answer is required
'
;
}
}
}
}
}
}
}
...
@@ -257,34 +262,27 @@ export default {
...
@@ -257,34 +262,27 @@ export default {
getQuestions
(
saveIndex
)
{
getQuestions
(
saveIndex
)
{
const
questionsArray
=
[]
const
questionsArray
=
[]
try
{
let
index
=
this
.
questionIndex
let
index
=
this
.
questionIndex
if
(
this
.
checkQuestion
(
index
))
{
if
(
this
.
checkQuestion
(
index
))
{
questionsArray
.
push
(
this
.
form
.
questions
[
index
])
questionsArray
.
push
(
this
.
form
.
questions
[
index
])
}
}
while
(
index
<
this
.
form
.
questions
.
length
-
1
)
{
index
=
index
+
1
const
textQ
=
this
.
form
.
questions
[
index
].
text
if
(
textQ
.
includes
(
'
[n]
'
)
&&
questionsArray
.
length
>
0
)
{
// index = index - 1
break
}
if
(
this
.
checkQuestion
(
index
))
{
while
(
index
<
this
.
form
.
questions
.
length
-
1
)
{
questionsArray
.
push
(
this
.
form
.
questions
[
index
])
index
=
index
+
1
}
const
textQ
=
this
.
form
.
questions
[
index
].
text
if
(
textQ
.
includes
(
'
[n]
'
)
&&
questionsArray
.
length
>
0
)
{
// index = index - 1
break
}
}
if
(
saveIndex
)
{
if
(
this
.
checkQuestion
(
index
,
saveIndex
)
)
{
this
.
question
Index
=
index
questionsArray
.
push
(
this
.
form
.
question
s
[
index
])
}
}
}
}
catch
(
error
)
{
if
(
saveIndex
)
{
this
.
logError
=
'
'
+
error
this
.
questionIndex
=
index
console
.
error
(
error
)
showError
(
t
(
'
forms
'
,
'
There was an error in the form
'
))
}
}
// const qTextSplit = questionsArray[0].text //.split('[') // [1/1]
// const qTextSplit = questionsArray[0].text //.split('[') // [1/1]
...
@@ -300,9 +298,8 @@ export default {
...
@@ -300,9 +298,8 @@ export default {
try
{
try
{
if
(
this
.
questionIndex
<
this
.
form
.
questions
.
length
-
1
)
{
if
(
this
.
questionIndex
<
this
.
form
.
questions
.
length
-
1
)
{
this
.
questionIndex
=
this
.
questionIndex
+
1
const
questions
=
this
.
getQuestions
(
true
)
const
questions
=
this
.
getQuestions
(
true
)
logError
+=
'
'
+
questions
.
length
if
(
questions
.
length
>
0
)
{
if
(
questions
.
length
>
0
)
{
return
return
...
...
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