Update to 2025-02-18 and 2025-02-19
This commit is contained in:
28
Scripts/cde.js
Normal file
28
Scripts/cde.js
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
// $('dcp.CDE4/csv/Avg', '') == '' ? '' : (parseFloat($('dcp.CDE4/csv/Dev', '0')) / parseFloat($('dcp.CDE4/csv/Avg', '0'))).toFixed(2) + '%'
|
||||
|
||||
// getValue($('dcp.CDE4/csv/Avg', ''), $('dcp.CDE4/csv/Dev', '0'), $('dcp.CDE4/csv/Avg', '0'));
|
||||
|
||||
function roundNumber(number, digits) {
|
||||
let result;
|
||||
const multiple = Math.pow(10, digits);
|
||||
result = Math.round(number * multiple) / multiple;
|
||||
return result;
|
||||
}
|
||||
|
||||
function getValue(avgRaw, devZeroDefault, avgZeroDefault) {
|
||||
let result;
|
||||
if (avgRaw == '')
|
||||
result = '';
|
||||
else {
|
||||
let raw = parseFloat(devZeroDefault) / parseFloat(avgZeroDefault);
|
||||
result = roundNumber(raw, 2);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const dev = 0.383;
|
||||
const avg = 33.5810;
|
||||
const value = getValue(avg, dev);
|
||||
console.log("value: " + value);
|
@ -95,13 +95,13 @@ function getNineResRangePercent(criticalRhoPoints) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getValue(allRhoAvg, index) {
|
||||
function getValue(edge10mmRhoPoints, index) {
|
||||
let result = null;
|
||||
if (index === 8) {
|
||||
if (allRhoAvg != undefined && allRhoAvg.length > 1) {
|
||||
let collection = allRhoAvg[0] === '|' ? allRhoAvg.substring(1).split('|') : allRhoAvg.split('|');
|
||||
if (edge10mmRhoPoints != undefined && edge10mmRhoPoints.length > 1) {
|
||||
let collection = edge10mmRhoPoints[0] === '|' ? edge10mmRhoPoints.substring(1).split('|') : edge10mmRhoPoints.split('|');
|
||||
let collectionParseFloat = getCollectionParseFloat(collection);
|
||||
result = average(collectionParseFloat);
|
||||
result = Math.round(getAverage(collectionParseFloat) * 10000000) / 10000000;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -132,23 +132,7 @@ console.log(nineCriticalPointsStdDev);
|
||||
// Sequence to date string
|
||||
// getValue(self, getContextData('1', 'cds.SEQUENCE', ''));
|
||||
|
||||
function getValue(value, sequence) {
|
||||
let result;
|
||||
if (sequence.length < 18)
|
||||
result = value;
|
||||
else {
|
||||
const epochTicks = 621355968000000000;
|
||||
const milliseconds = (sequence - epochTicks) / 10000;
|
||||
const date = new Date(milliseconds);
|
||||
result = date.toString();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const date = '3/26/2025';
|
||||
const sequence = '638784250251441727';
|
||||
const value = getValue(date, sequence);
|
||||
if (value === 1742853453)
|
||||
console.info("Pass");
|
||||
else
|
||||
console.warn("Fail");
|
||||
const index = 8;
|
||||
const gv_edge10mmRhoPoints = '|3.076|2.821|2.765|2.876';
|
||||
const value = roundNumber(getValue(gv_edge10mmRhoPoints, index), 7);
|
||||
console.log("value: " + value);
|
Reference in New Issue
Block a user