Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
ai
Commits
f9844b1d
Commit
f9844b1d
authored
Apr 14, 2022
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git pu
parent
40709d5c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
42 deletions
+31
-42
uniq2.js
uniq2.js
+31
-42
No files found.
uniq2.js
View file @
f9844b1d
...
@@ -3,8 +3,7 @@ let _ = require('lodash')
...
@@ -3,8 +3,7 @@ let _ = require('lodash')
let
moment
=
require
(
'
moment-timezone
'
)
let
moment
=
require
(
'
moment-timezone
'
)
run
()
run
()
let
adder
=
[]
let
adder
=
[]
async
function
run
()
{
async
function
run
()
{
...
@@ -12,10 +11,10 @@ async function run() {
...
@@ -12,10 +11,10 @@ async function run() {
let
configs
=
await
fs
.
readdirSync
(
'
uniq/
'
)
let
configs
=
await
fs
.
readdirSync
(
'
uniq/
'
)
let
arr
=
[]
let
arr
=
[]
let
arrSide
=
[]
let
arrSide
=
[]
let
arrRunup
=
[]
let
arrRunup
=
[]
let
total
=
[]
let
total
=
[]
let
levelPlus
=
[]
let
levelPlus
=
[]
let
types
=
[]
let
types
=
[]
for
(
let
i
=
0
;
i
<
configs
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
configs
.
length
;
i
++
)
{
...
@@ -33,7 +32,7 @@ async function run() {
...
@@ -33,7 +32,7 @@ async function run() {
for
(
let
z
=
0
;
z
<
dateString
.
length
-
1
;
z
++
)
for
(
let
z
=
0
;
z
<
dateString
.
length
-
1
;
z
++
)
arrDate
.
push
(
dateString
[
z
])
arrDate
.
push
(
dateString
[
z
])
add
(
config
[
j
].
total
,
arrDate
,
config
[
j
].
type
.
split
(
'
targetPercentage:false
'
)[
1
])
add
(
config
[
j
].
total
,
arrDate
,
config
[
j
].
type
.
split
(
'
targetPercentage:false
'
)[
1
])
}
}
...
@@ -43,35 +42,30 @@ async function run() {
...
@@ -43,35 +42,30 @@ async function run() {
adder
=
_
.
orderBy
(
adder
,
[
'
total
'
],
[
'
asc
'
]);
adder
=
_
.
orderBy
(
adder
,
[
'
total
'
],
[
'
asc
'
]);
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
{
for
(
let
z
=
i
+
1
;
z
<
adder
.
length
;
z
++
)
{
for
(
let
z
=
i
+
1
;
z
<
adder
.
length
;
z
++
)
add
(
adder
[
i
].
total
,
adder
[
z
].
dates
)
{
add
(
adder
[
i
].
total
,
adder
[
z
].
dates
)
}
}
}
}
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
{
for
(
let
z
=
i
+
1
;
z
<
adder
.
length
;
z
++
)
{
for
(
let
z
=
i
+
1
;
z
<
adder
.
length
;
z
++
)
let
types
=
adder
[
z
].
type
{
for
(
let
l
=
0
;
l
<
types
.
length
;
l
++
)
let
types
=
adder
[
z
].
type
for
(
let
l
=
0
;
l
<
types
.
length
;
l
++
)
add
(
adder
[
i
].
total
,
adder
[
z
].
dates
,
types
[
l
])
add
(
adder
[
i
].
total
,
adder
[
z
].
dates
,
types
[
l
])
}
}
}
}
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
{
adder
[
i
].
dates
=
_
.
uniq
(
adder
[
i
].
dates
)
adder
[
i
].
dates
=
_
.
orderBy
(
adder
[
i
].
dates
)
adder
[
i
].
dates
=
_
.
orderBy
(
adder
[
i
].
dates
)
}
}
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
{
let
dates
=
adder
[
i
].
dates
let
dates
=
adder
[
i
].
dates
let
maxDiff
=
0
let
maxDiff
=
0
for
(
let
z
=
0
;
z
<
dates
.
length
-
1
;
z
++
)
{
for
(
let
z
=
0
;
z
<
dates
.
length
-
1
;
z
++
)
{
...
@@ -80,33 +74,28 @@ async function run() {
...
@@ -80,33 +74,28 @@ async function run() {
maxDiff
=
diff
maxDiff
=
diff
}
}
adder
[
i
].
diffDay
=
maxDiff
adder
[
i
].
diffDay
=
maxDiff
}
}
console
.
log
(
adder
)
console
.
log
(
adder
)
createConfileADV
(
JSON
.
stringify
(
adder
,
null
,
2
))
createConfileADV
(
JSON
.
stringify
(
adder
,
null
,
2
))
}
}
function
add
(
total
,
dates
,
type
)
function
add
(
total
,
dates
,
type
)
{
{
let
found
=
false
let
found
=
false
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
if
(
adder
[
i
].
total
===
total
)
{
if
(
adder
[
i
].
total
===
total
)
found
=
true
{
for
(
let
z
=
0
;
z
<
dates
.
length
;
z
++
)
found
=
true
for
(
let
z
=
0
;
z
<
dates
.
length
;
z
++
)
adder
[
i
].
dates
.
push
(
dates
[
z
])
adder
[
i
].
dates
.
push
(
dates
[
z
])
adder
[
i
].
countDay
=
adder
[
i
].
dates
.
length
adder
[
i
].
countDay
=
adder
[
i
].
dates
.
length
if
(
type
)
if
(
type
)
adder
[
i
].
type
.
push
(
type
)
adder
[
i
].
type
.
push
(
type
)
}
}
...
@@ -114,7 +103,7 @@ function add(total,dates,type)
...
@@ -114,7 +103,7 @@ function add(total,dates,type)
if
(
found
)
if
(
found
)
return
return
adder
.
push
({
total
:
total
,
dates
:
dates
,
countDay
:
dates
.
length
,
type
:
[
type
]})
adder
.
push
({
total
:
total
,
dates
:
dates
,
countDay
:
dates
.
length
,
type
:
[
type
]})
}
}
...
...
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