Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kus-admin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Кубота
kus-admin
Commits
b3873449
Commit
b3873449
authored
Feb 13, 2020
by
Иван Кубота
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix standard generation
parent
d203ac43
Pipeline
#543
failed with stage
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
quizGenerator.js
public/js/controller/quizGenerator.js
+2
-0
generateRandom.js
src/api/generateRandom.js
+9
-2
No files found.
public/js/controller/quizGenerator.js
View file @
b3873449
...
...
@@ -56,6 +56,8 @@ const standardGenerator = function(random) {
const
log
=
quizGenerator
.
log
=
[
'Random seed: '
+
initialSeed
];
const
questionID
=
random
(
Object
.
values
(
dP
.
standardQuestions
)),
q
=
dP
.
standardQuestions
[
questionID
];
if
(
!
q
)
return
false
;
log
.
push
(
'Creating standard question.'
);
log
.
push
(
'It would be question number '
+
questionID
);
log
.
push
(
''
);
...
...
src/api/generateRandom.js
View file @
b3873449
...
...
@@ -65,11 +65,14 @@ module.exports = {
photo
=
seeded
()
>
0.7
,
result
;
if
((
args
.
type
!==
void
0
?
args
.
type
===
2
:
seeded
()
>
0.5
)){
result
=
ctx
.
standardGenerator
(()
=>
rand
(
1
,
countStdQ
))
while
(
!
result
){
if
(
(
args
.
type
!==
void
0
?
args
.
type
===
2
:
seeded
()
>
0.5
)
){
result
=
ctx
.
standardGenerator
(
()
=>
rand
(
1
,
countStdQ
)
)
}
else
{
result
=
ctx
.
quizGenerator
(
multiple
?
'checkbox'
:
'radio'
,
args
.
photo
!==
void
0
?
args
.
photo
:
photo
);
}
}
console
.
log
(
`cat:
${
result
.
categoryId
}
, prod:
${
result
.
productId
}
, seed:
${
seed
}
.
${
result
.
question
.
substr
(
0
,
33
)}
`
);
if
(
args
.
nolog
)
...
...
@@ -128,6 +131,10 @@ module.exports = {
}
else
{
result
=
ctx
.
standardGenerator
(()
=>
cur
.
id
)
if
(
!
result
){
tries
=
100
;
break
;
}
}
tries
++
;
if
(
tries
===
100
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment