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
0299c626
Commit
0299c626
authored
Mar 06, 2020
by
Иван Кубота
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new tag based sequence generator
parent
2ea85a78
Pipeline
#566
canceled with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
199 additions
and
96 deletions
+199
-96
checkbox.js
public/js/controller/quizBits/checkbox.js
+2
-2
main.js
public/js/controller/quizBits/main.js
+11
-11
radio.js
public/js/controller/quizBits/radio.js
+2
-2
quizGenerator.js
public/js/controller/quizGenerator.js
+8
-8
generateRandom.js
src/api/generateRandom.js
+176
-73
No files found.
public/js/controller/quizBits/checkbox.js
View file @
0299c626
...
@@ -77,14 +77,14 @@ quizTypes.checkbox = [ ComponentsOfProduct = {
...
@@ -77,14 +77,14 @@ quizTypes.checkbox = [ ComponentsOfProduct = {
type
:
'Select components of product'
,
type
:
'Select components of product'
,
products
:
{
from
:
2
,
to
:
4
},
products
:
{
from
:
2
,
to
:
4
},
minSimilarTags
:
1
,
minSimilarTags
:
1
,
from
(
log
){
from
(
log
,
isTest
){
const
products
=
qB
.
randomProduct
({
const
products
=
qB
.
randomProduct
({
minComponents
:
1
,
minComponents
:
1
,
amount
:
this
.
products
,
amount
:
this
.
products
,
connectedByTags
:
true
,
connectedByTags
:
true
,
minSimilarTags
:
this
.
minSimilarTags
,
minSimilarTags
:
this
.
minSimilarTags
,
doNotTrim
:
true
doNotTrim
:
true
},
log
),
},
log
,
isTest
),
componentsWithProducts
=
qB
.
getComponentsWithSharedProducts
(
products
,
2
);
componentsWithProducts
=
qB
.
getComponentsWithSharedProducts
(
products
,
2
);
...
...
public/js/controller/quizBits/main.js
View file @
0299c626
...
@@ -7,7 +7,7 @@ const qB = {
...
@@ -7,7 +7,7 @@ const qB = {
minSimilarTags
,
minSimilarTags
,
doNotTrim
,
doNotTrim
,
withPhoto
withPhoto
},
log
)
{
},
log
,
isTest
)
{
let
filtered
=
Object
.
values
(
dP
.
products
);
let
filtered
=
Object
.
values
(
dP
.
products
);
...
@@ -74,7 +74,7 @@ const qB = {
...
@@ -74,7 +74,7 @@ const qB = {
similarClusters
=
Object
.
keys
(
similarTags
)
similarClusters
=
Object
.
keys
(
similarTags
)
.
map
(
k
=>
({
k
,
v
:
similarTags
[
k
]}))
.
map
(
k
=>
({
k
,
v
:
similarTags
[
k
]}))
.
filter
(
a
=>
a
.
v
.
length
>=
minAmount
&&
a
.
v
.
filter
(
av
=>
av
.
use
).
length
>
0
);
.
filter
(
a
=>
a
.
v
.
length
>=
minAmount
&&
a
.
v
.
filter
(
isTest
).
length
>
0
);
log
.
push
(
`Clusters that have >=
${
minSimilarTags
}
similar tags: `
+
Object
.
values
(
similarClusters
).
length
);
log
.
push
(
`Clusters that have >=
${
minSimilarTags
}
similar tags: `
+
Object
.
values
(
similarClusters
).
length
);
...
@@ -89,7 +89,7 @@ const qB = {
...
@@ -89,7 +89,7 @@ const qB = {
let
result
;
let
result
;
if
(
single
){
if
(
single
){
result
=
rand
(
filtered
.
filter
(
p
=>
p
.
use
));
result
=
rand
(
filtered
.
filter
(
isTest
));
log
.
push
(
'Matched product: '
+
result
.
title
);
log
.
push
(
'Matched product: '
+
result
.
title
);
}
else
{
}
else
{
...
@@ -98,7 +98,7 @@ const qB = {
...
@@ -98,7 +98,7 @@ const qB = {
return
false
;
return
false
;
}
}
let
used
=
rand
(
filtered
.
filter
(
p
=>
p
.
use
)),
let
used
=
rand
(
filtered
.
filter
(
isTest
)),
other
=
filtered
.
slice
();
other
=
filtered
.
slice
();
other
.
splice
(
other
.
indexOf
(
used
));
other
.
splice
(
other
.
indexOf
(
used
));
...
@@ -192,11 +192,11 @@ const qB = {
...
@@ -192,11 +192,11 @@ const qB = {
prebuild
:
{
prebuild
:
{
similarTaggedProductWithPhotoAndComponents
:
{
similarTaggedProductWithPhotoAndComponents
:
{
fn
:
function
(
log
)
{
fn
:
function
(
log
,
isTest
)
{
this
.
getEmAll
=
true
;
this
.
getEmAll
=
true
;
this
.
products
=
{
min
:
2
};
this
.
products
=
{
min
:
2
};
const
possibilities
=
shuffle
(
const
possibilities
=
shuffle
(
qB
.
prebuild
.
similarTaggedProductWithPhoto
.
fn
.
call
(
this
,
log
)
qB
.
prebuild
.
similarTaggedProductWithPhoto
.
fn
.
call
(
this
,
log
,
isTest
)
);
);
if
(
!
possibilities
||
!
possibilities
.
length
)
if
(
!
possibilities
||
!
possibilities
.
length
)
return
false
;
return
false
;
...
@@ -238,7 +238,7 @@ const qB = {
...
@@ -238,7 +238,7 @@ const qB = {
questionMinComponentsCount
:
Number
,
questionMinComponentsCount
:
Number
,
products
:
{
min
:
Number
,
max
:
Number
},
products
:
{
min
:
Number
,
max
:
Number
},
fn
:
function
(
log
)
{
fn
:
function
(
log
,
isTest
)
{
let
allProducts
=
Object
.
values
(
dP
.
products
);
let
allProducts
=
Object
.
values
(
dP
.
products
);
let
products
=
Object
.
values
(
dP
.
products
)
let
products
=
Object
.
values
(
dP
.
products
)
.
filter
(
p
=>
p
.
image
)
.
filter
(
p
=>
p
.
image
)
...
@@ -251,7 +251,7 @@ const qB = {
...
@@ -251,7 +251,7 @@ const qB = {
}
}
const
possibility
=
products
.
map
(
p
=>
{
const
possibility
=
products
.
map
(
p
=>
{
if
(
!
p
.
use
)
if
(
!
isTest
(
p
)
)
return
false
;
return
false
;
const
similar
=
qB
.
getProductsWithTags
({
const
similar
=
qB
.
getProductsWithTags
({
products
:
allProducts
,
products
:
allProducts
,
...
@@ -285,20 +285,20 @@ const qB = {
...
@@ -285,20 +285,20 @@ const qB = {
// product similarity (minimal matched tags count)
// product similarity (minimal matched tags count)
minSimilarTags
:
2
,
minSimilarTags
:
2
,
fn
(
log
){
fn
(
log
,
isTest
){
let
products
=
qB
.
randomProduct
({
let
products
=
qB
.
randomProduct
({
minComponents
:
this
.
questionCmpAmount
,
minComponents
:
this
.
questionCmpAmount
,
amount
:
this
.
products
,
amount
:
this
.
products
,
connectedByTags
:
true
,
connectedByTags
:
true
,
minSimilarTags
:
this
.
minSimilarTags
minSimilarTags
:
this
.
minSimilarTags
},
log
);
},
log
,
isTest
);
for
(
let
i
=
0
,
_i
=
products
.
length
;
i
<
_i
;
i
++
){
for
(
let
i
=
0
,
_i
=
products
.
length
;
i
<
_i
;
i
++
){
const
product
=
products
[
i
];
const
product
=
products
[
i
];
/* if(this.withPhoto && !product.image)
/* if(this.withPhoto && !product.image)
continue;*/
continue;*/
if
(
!
product
.
use
)
if
(
!
isTest
(
product
)
)
continue
;
continue
;
const
cmps
=
product
const
cmps
=
product
.
getComponents
()
.
getComponents
()
...
...
public/js/controller/quizBits/radio.js
View file @
0299c626
...
@@ -88,8 +88,8 @@ quizTypes.radio = [
...
@@ -88,8 +88,8 @@ quizTypes.radio = [
question
:
({
product
})
=>
`Выберите лишний ингредиент, НЕ входящий в продукт "
${
product
.
title
}
"`
,
question
:
({
product
})
=>
`Выберите лишний ингредиент, НЕ входящий в продукт "
${
product
.
title
}
"`
,
type
:
'Do not contain'
,
type
:
'Do not contain'
,
from
:
(
log
)
=>
{
from
:
(
log
,
isTest
)
=>
{
const
product
=
qB
.
randomProduct
({
minComponents
:
2
,
single
:
true
},
log
);
const
product
=
qB
.
randomProduct
({
minComponents
:
2
,
single
:
true
},
log
,
isTest
);
return
{
baseProduct
:
product
,
product
}
return
{
baseProduct
:
product
,
product
}
},
},
...
...
public/js/controller/quizGenerator.js
View file @
0299c626
...
@@ -81,10 +81,10 @@ const standardGenerator = function(random) {
...
@@ -81,10 +81,10 @@ const standardGenerator = function(random) {
log
log
};
};
};
};
const
quizGenerator
=
function
(
type
,
photo
,
subType
)
{
const
quizGenerator
=
function
(
type
,
photo
,
isTest
,
subType
)
{
return
_quizGenerator
(
type
,
photo
,
subType
);
return
_quizGenerator
(
type
,
photo
,
isTest
,
subType
);
},
},
_quizGenerator
=
function
(
type
,
photo
,
subType
,
attempt
)
{
_quizGenerator
=
function
(
type
,
photo
,
isTest
,
subType
,
attempt
)
{
attempt
=
attempt
||
0
;
attempt
=
attempt
||
0
;
const
initialSeed
=
Math
.
random
.
seeded
.
getStringSeed
();
const
initialSeed
=
Math
.
random
.
seeded
.
getStringSeed
();
let
log
;
let
log
;
...
@@ -119,23 +119,23 @@ const quizGenerator = function(type, photo, subType) {
...
@@ -119,23 +119,23 @@ const quizGenerator = function(type, photo, subType) {
if
(
!
cfg
)
if
(
!
cfg
)
return
{
answers
:
[],
log
};
return
{
answers
:
[],
log
};
const
source
=
cfg
.
from
.
call
(
cfg
,
log
);
const
source
=
cfg
.
from
.
call
(
cfg
,
log
,
isTest
);
if
(
source
===
false
){
if
(
source
===
false
){
// давай по новой
// давай по новой
return
_quizGenerator
(
type
,
photo
,
subType
,
attempt
+
1
);
return
_quizGenerator
(
type
,
photo
,
isTest
,
subType
,
attempt
+
1
);
}
}
let
answers
=
shuffle
(
cfg
.
answer
.
call
(
cfg
,
source
,
log
));
let
answers
=
shuffle
(
cfg
.
answer
.
call
(
cfg
,
source
,
log
,
isTest
));
if
(
answers
===
false
||
answers
.
length
===
1
){
if
(
answers
===
false
||
answers
.
length
===
1
){
// давай по новой
// давай по новой
return
_quizGenerator
(
type
,
photo
,
subType
,
attempt
+
1
);
return
_quizGenerator
(
type
,
photo
,
isTest
,
subType
,
attempt
+
1
);
}
}
return
{
return
{
seed
:
initialSeed
,
seed
:
initialSeed
,
type
,
type
,
categoryId
:
1
,
categoryId
:
1
,
productId
:
source
.
baseProduct
.
id
,
productId
:
source
.
baseProduct
.
id
,
question
:
cfg
.
question
.
call
(
cfg
,
source
,
log
),
question
:
cfg
.
question
.
call
(
cfg
,
source
,
log
,
isTest
),
answers
,
answers
,
image
:
!
photo
?
null
:
source
.
baseProduct
.
image
,
image
:
!
photo
?
null
:
source
.
baseProduct
.
image
,
...
...
src/api/generateRandom.js
View file @
0299c626
...
@@ -32,7 +32,7 @@ var js = sources.map(a=>path.join(__dirname,'../../public',a)).map(n=>fs.readFil
...
@@ -32,7 +32,7 @@ var js = sources.map(a=>path.join(__dirname,'../../public',a)).map(n=>fs.readFil
let
data
=
require
(
"../../db.js"
);
let
data
=
require
(
"../../db.js"
);
const
body
=
'const window = {}, localStorage = {getItem:()=>"{}"};'
+
js
+
'; return {quizGenerator, standardGenerator, quizTypes, probabilityRand, initDataProvider, seeded: Math.random.seeded, rand, dP}'
;
const
body
=
'const window = {}, localStorage = {getItem:()=>"{}"};'
+
js
+
'; return {
shuffle,
quizGenerator, standardGenerator, quizTypes, probabilityRand, initDataProvider, seeded: Math.random.seeded, rand, dP}'
;
var
ctxCtor
=
new
Function
(
''
,
body
);
var
ctxCtor
=
new
Function
(
''
,
body
);
...
@@ -350,10 +350,12 @@ module.exports = {
...
@@ -350,10 +350,12 @@ module.exports = {
connections
:
[],
connections
:
[],
products
:
{},
products
:
{},
components
:
{},
components
:
{},
standardQuestions
:
{}
standardQuestions
:
{},
category
:
{}
};
};
var
cmpID
=
1
;
var
cmpID
=
1
;
l
.
forEach
(
category
=>
{
l
.
forEach
(
category
=>
{
mimicri
.
category
[
category
.
id
]
=
{
name
:
category
.
name
,
title
:
category
.
title
,
type
:
category
.
type
,
id
:
category
.
id
};
if
(
category
.
type
===
1
&&
!
category
.
hidden
){
if
(
category
.
type
===
1
&&
!
category
.
hidden
){
category
.
cards
.
forEach
(
card
=>
{
category
.
cards
.
forEach
(
card
=>
{
card
.
components
.
forEach
(
cmp
=>
{
card
.
components
.
forEach
(
cmp
=>
{
...
@@ -557,7 +559,8 @@ module.exports = {
...
@@ -557,7 +559,8 @@ module.exports = {
nolog
:
{
required
:
false
,
description
:
'remove human readable log'
,
type
:
Boolean
},
nolog
:
{
required
:
false
,
description
:
'remove human readable log'
,
type
:
Boolean
},
stats
:
{
required
:
false
,
description
:
'aggregate stats and explain questions'
,
type
:
Boolean
},
stats
:
{
required
:
false
,
description
:
'aggregate stats and explain questions'
,
type
:
Boolean
},
human
:
{
required
:
false
,
description
:
'aggregate stats and explain questions'
,
type
:
Boolean
},
human
:
{
required
:
false
,
description
:
'aggregate stats and explain questions'
,
type
:
Boolean
},
category
:
{
required
:
false
,
description
:
'comma sepparated categories'
,
type
:
String
},
category
:
{
required
:
false
,
description
:
'comma separated categories'
,
type
:
String
},
tags
:
{
required
:
false
,
description
:
'comma separated tags'
,
type
:
Array
},
},
},
fn
:
async
function
(
args
,
req
,
res
)
{
fn
:
async
function
(
args
,
req
,
res
)
{
await
ctx
.
ready
;
const
rand
=
ctx
.
rand
,
seeded
=
ctx
.
seeded
;
await
ctx
.
ready
;
const
rand
=
ctx
.
rand
,
seeded
=
ctx
.
seeded
;
...
@@ -581,97 +584,197 @@ module.exports = {
...
@@ -581,97 +584,197 @@ module.exports = {
globalMaxTries
=
args
.
count
*
500
,
globalMaxTries
=
args
.
count
*
500
,
globalTries
=
0
;
globalTries
=
0
;
if
(
args
.
count
>
100
)
args
.
count
=
100
;
if
(
args
.
count
>
100
)
args
.
count
=
100
;
while
(
generated
<
args
.
count
&&
globalTries
<
globalMaxTries
){
globalTries
++
;
let
option
=
ctx
.
probabilityRand
([].
concat
.
apply
([],
Object
.
values
(
ctx
.
quizTypes
)))
let
multiple
=
option
.
multiple
,
//seeded() > 24 / ( 46 + 24 ),
if
(
args
.
tags
){
photo
=
option
.
photo
;
//seeded() > 0.7
let
tags
=
args
.
tags
.
map
(
t
=>
ctx
.
dP
.
tagsHash
[
t
]);
let
info
=
{};
let
cur
=
{
let
isTest
=
{};
m
:
multiple
,
//seeded() > 24 / ( 46 + 24 ),
let
isTestFn
=
(
p
)
=>
{
p
:
photo
,
//seeded() > 0.7,
let
c
=
p
.
category_id
,
id
=
p
.
id
;
c
:
1
return
isTest
[
c
]
&&
isTest
[
c
][
id
];
};
};
if
(
(
useCategory
&&
!
categoryHash
[
1
])
||
seeded
()
>
0.3
){
let
productTagCount
=
0
,
//if( last.c === 1 && seeded() > 0.5 ){
pCount
=
0
;
cur
=
{
c
:
2
tags
.
forEach
(
t
=>
{
};
if
(
t
.
type_id
===
7
){
let
id
,
tries
=
0
;
let
category
=
ctx
.
dP
.
category
[
t
.
category_id
];
/*do{
if
(
category
.
type
===
2
){
id = rand(1, countStdQ);
info
[
category
.
id
]
=
true
;
tries++;
}
else
{
if(tries === 100){
if
(
!
(
category
.
id
in
isTest
))
break;
isTest
[
category
.
id
]
=
{};
Object
.
values
(
ctx
.
dP
.
products
)
.
filter
(
p
=>
p
.
category_id
===
category
.
id
)
.
forEach
(
c
=>
isTest
[
category
.
id
][
c
.
id
]
=
true
);
}
}
}while('2.'+id in used);*/
}
else
if
(
t
.
type_id
===
13
){
if
(
tries
===
100
)
productTagCount
++
;
continue
;
Object
.
values
(
ctx
.
dP
.
products
)
cur
.
id
=
id
;
.
filter
(
p
=>
p
.
tags
&&
p
.
tags
.
indexOf
(
t
.
id
)
>-
1
)
}
.
forEach
(
p
=>
{
if
(
!
(
p
.
category_id
in
isTest
))
isTest
[
p
.
category_id
]
=
{};
pCount
++
;
isTest
[
p
.
category_id
][
p
.
id
]
=
true
;
});
}
});
let
tries
=
0
,
// СФОРМИРОВАЛИ ОЖИДАНИЮ
result
;
do
{
let
queues
=
{};
if
(
cur
.
c
===
1
){
Object
.
keys
(
info
).
forEach
(
k
=>
{
result
=
ctx
.
quizGenerator
(
cur
.
m
?
'checkbox'
:
'radio'
,
cur
.
p
);
k
=
parseInt
(
k
,
10
);
queues
[
k
]
=
ctx
.
shuffle
(
Object
.
values
(
data
.
standardQuestions
)
.
filter
(
q
=>
q
.
category_id
===
k
)
.
map
(
(
q
)
=>
q
.
qID
));
});
let
groups
=
[];
Object
.
keys
(
queues
).
forEach
(
k
=>
{
groups
.
push
({
type
:
2
,
id
:
k
,
count
:
queues
[
k
].
length
});
});
for
(
let
i
=
0
;
i
<
productTagCount
;
i
++
){
groups
.
push
({
type
:
1
,
count
:
pCount
});
}
let
step
=
groups
.
slice
();
while
(
generated
<
args
.
count
&&
globalTries
<
globalMaxTries
){
let
result
;
globalTries
++
;
let
take
=
ctx
.
rand
(
step
);
if
(
take
.
type
===
2
){
let
took
=
queues
[
take
.
id
].
pop
();
take
.
count
--
;
if
(
!
take
.
count
){
groups
.
splice
(
groups
.
indexOf
(
take
),
1
);
if
(
!
groups
.
length
)
break
;
}
result
=
ctx
.
standardGenerator
(
()
=>
took
);
}
else
{
}
else
{
let
counter
=
0
,
r
=
2
;
let
option
=
ctx
.
probabilityRand
([].
concat
.
apply
([],
Object
.
values
(
ctx
.
quizTypes
)))
let
multiple
=
option
.
multiple
,
photo
=
option
.
photo
;
result
=
ctx
.
quizGenerator
(
multiple
?
'checkbox'
:
'radio'
,
args
.
photo
!==
void
0
?
args
.
photo
:
photo
,
isTestFn
);
}
if
(
useCategory
){
if
(
result
){
list
.
push
(
result
);
generated
++
;
}
step
=
groups
.
length
>
1
?
groups
.
slice
().
filter
(
i
=>
i
!==
take
):
groups
.
slice
();
}
let
possible
=
Object
.
values
(
data
.
standardQuestions
)
// new generator;
.
map
(
(
q
)
=>
(
{
q
,
c
:
q
.
category_id
,
n
:
q
.
qID
}
)
)
.
filter
(
q
=>
q
.
c
in
categoryHash
)
}
else
{
.
filter
(
q
=>
!
(
q
.
c
+
'.'
+
q
.
n
in
used
)
)
.
map
(
q
=>
q
.
n
);
while
(
generated
<
args
.
count
&&
globalTries
<
globalMaxTries
){
if
(
possible
.
length
){
globalTries
++
;
r
=
rand
(
possible
)
}
else
{
let
option
=
ctx
.
probabilityRand
(
[].
concat
.
apply
(
[],
Object
.
values
(
ctx
.
quizTypes
)
)
)
error
=
'Not enough questions'
;
let
multiple
=
option
.
multiple
,
//seeded() > 24 / ( 46 + 24 ),
photo
=
option
.
photo
;
//seeded() > 0.7
let
cur
=
{
m
:
multiple
,
//seeded() > 24 / ( 46 + 24 ),
p
:
photo
,
//seeded() > 0.7,
c
:
1
};
if
(
(
useCategory
&&
!
categoryHash
[
1
]
)
||
seeded
()
>
0.3
){
//if( last.c === 1 && seeded() > 0.5 ){
cur
=
{
c
:
2
};
let
id
,
tries
=
0
;
/*do{
id = rand(1, countStdQ);
tries++;
if(tries === 100){
break;
break;
}
}
}while('2.'+id in used);*/
if
(
tries
===
100
)
continue
;
cur
.
id
=
id
;
}
let
tries
=
0
,
result
;
do
{
if
(
cur
.
c
===
1
){
result
=
ctx
.
quizGenerator
(
cur
.
m
?
'checkbox'
:
'radio'
,
cur
.
p
);
}
else
{
}
else
{
do
{
let
counter
=
0
,
r
=
2
;
r
=
rand
(
1
,
countStdQ
);
let
q
=
data
.
standardQuestions
[
r
];
if
(
useCategory
){
if
(
q
&&
!
(
q
.
category_id
+
'.'
+
q
.
qID
in
used
)
)
let
possible
=
Object
.
values
(
data
.
standardQuestions
)
.
map
(
(
q
)
=>
(
{
q
,
c
:
q
.
category_id
,
n
:
q
.
qID
}
)
)
.
filter
(
q
=>
q
.
c
in
categoryHash
)
.
filter
(
q
=>
!
(
q
.
c
+
'.'
+
q
.
n
in
used
)
)
.
map
(
q
=>
q
.
n
);
if
(
possible
.
length
){
r
=
rand
(
possible
)
}
else
{
error
=
'Not enough questions'
;
break
;
break
;
counter
++
;
}
}
while
(
counter
<
100
);
}
result
=
ctx
.
standardGenerator
(()
=>
r
);
}
else
{
do
{
r
=
rand
(
1
,
countStdQ
);
let
q
=
data
.
standardQuestions
[
r
];
if
(
q
&&
!
(
q
.
category_id
+
'.'
+
q
.
qID
in
used
)
)
break
;
counter
++
;
}
while
(
counter
<
100
);
}
result
=
ctx
.
standardGenerator
(
()
=>
r
);
if
(
!
result
){
tries
=
100
;
if
(
!
result
){
break
;
tries
=
100
;
break
;
}
}
}
}
tries
++
;
tries
++
;
if
(
tries
===
100
)
if
(
tries
===
100
)
break
;
}
while
(
result
.
categoryId
+
'.'
+
result
.
productId
in
used
||
(
(
cur
.
c
>
1
&&
result
.
categoryId
===
last
.
c
)
&&
!
useCategory
)
);
if
(
error
)
break
;
break
;
}
while
(
result
.
categoryId
+
'.'
+
result
.
productId
in
used
||
((
cur
.
c
>
1
&&
result
.
categoryId
===
last
.
c
)
&&
!
useCategory
));
if
(
tries
!==
100
){
cur
.
c
=
result
.
categoryId
;
if
(
error
)
break
;
used
[
result
.
categoryId
+
'.'
+
result
.
productId
]
=
true
;
if
(
tries
!==
100
){
list
.
push
(
result
);
cur
.
c
=
result
.
categoryId
;
if
(
args
.
nolog
)
delete
result
.
log
;
used
[
result
.
categoryId
+
'.'
+
result
.
productId
]
=
true
;
last
=
cur
;
list
.
push
(
result
);
generated
++
;
if
(
args
.
nolog
)
result
.
number
=
generated
;
delete
result
.
log
;
}
last
=
cur
;
generated
++
;
result
.
number
=
generated
;
}
}
}
}
if
(
args
.
stats
){
if
(
args
.
stats
){
res
.
header
(
"Content-Type"
,
"text/html; charset=utf-8"
);
res
.
header
(
"Content-Type"
,
"text/html; charset=utf-8"
);
let
stats
=
{};
let
stats
=
{};
...
...
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