Commit fb3b3a22 authored by Ahmad Nemati's avatar Ahmad Nemati

git pu

parent de7a73cc
......@@ -31,10 +31,18 @@ async function run() {
let arrDate = []
for (let z = 0; z < dateString.length - 1; z++)
arrDate.push(dateString[z])
let sideString = config[j].sideString.split('_')
let countOfshort = 0
let countOfLong = 0
for (let z = 0; z < sideString.length - 1; z++)
if (sideString[z] === 'LONG')
countOfLong++
else
countOfshort++
add(config[j].total, arrDate, config[j].type.split('targetPercentage:false')[1])
addShortLong(config[j].total, countOfshort, countOfLong)
}
......@@ -43,13 +51,22 @@ async function run() {
adder = _.orderBy(adder, ['total'], ['asc']);
for (let i = 0; i < adder.length; i++) {
for (let z = i + 1; z < adder.length; z++) {
add(adder[i].total, adder[z].dates)
}
}
for (let i = 0; i < adder.length; i++) {
let countOfShort = adder[i].short
let countOfLong = adder[i].long
for (let z = i + 1; z < adder.length; z++) {
countOfShort = countOfShort + adder[z].short
countOfLong = countOfLong + adder[z].long
}
addShortLong(adder[i].total,countOfShort,countOfLong)
}
var startTime = performance.now()
for (let i = 0; i < adder.length; i++) {
for (let z = i + 1; z < adder.length; z++) {
......@@ -65,12 +82,12 @@ async function run() {
for (let i = 0; i < adder.length; i++) {
adder[i].dates=_.uniq(adder[i].dates)
adder[i].dates = _.uniq(adder[i].dates)
adder[i].dates = _.orderBy(adder[i].dates)
adder[i].countDay = adder[i].dates.length
}
for (let i = 0; i < adder.length; i++) {
adder[i].type=_.uniq(adder[i].type)
adder[i].type = _.uniq(adder[i].type)
adder[i].type = _.orderBy(adder[i].type)
}
......@@ -102,16 +119,14 @@ function add(total, dates, type) {
for (let i = 0; i < adder.length; i++)
if (adder[i].total === total) {
found = true
if ( dates !==null)
{
if (dates !== null) {
for (let z = 0; z < dates.length; z++)
adder[i].dates.push(dates[z])
}
if (typeof type !=="undefined")
if (typeof type !== "undefined")
adder[i].type.push(type)
}
......@@ -122,6 +137,16 @@ function add(total, dates, type) {
}
function addShortLong(total, short, long) {
for (let i = 0; i < adder.length; i++)
if (adder[i].total === total) {
adder[i].short = short
adder[i].long = long
}
}
function getDaysDiff(start, closed) {
//2019-05-25T05:34:27+04:30
var now = moment(moment(closed, 'YYYY-MM-DD').format());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment