process.env.LOG_LEVEL='trace' "trace" prettier-eslint [TRACE]: called format with options: Object { "filePath": "/Users/devgurus/Projects/bluestar_dashboard/src/modules/reports/client/controllers/reports.client.offers.controller.js", "prettierLast": false, "text": "/* eslint-disable no-undef */ angular.module('reports').controller('ReportsOffersCtrl', [ '$scope', '$moment', 'Reports', '$log', 'toastr', ($scope, $moment, Reports, $log, toastr) => { function initCalendar() { $scope.startDate = $moment().startOf('month').toDate(); $scope.endDate = $moment().endOf('month').toDate(); $scope.rangeOptions = { ranges: { Today: [$moment(), $moment()], Yesterday: [$moment().subtract(1, 'days'), $moment().subtract(1, 'days')], 'Last 7 Days': [$moment().subtract(7, 'days'), $moment()], 'Last 30 Days': [$moment().subtract(29, 'days'), $moment()], 'This Month': [$moment().startOf('month'), $moment().endOf('month')], 'Last Month': [ $moment().subtract(1, 'month').startOf('month'), $moment().subtract(1, 'month').endOf('month'), ], }, opens: 'right', drops: 'down', startDate: $moment().startOf('month'), endDate: $moment().endOf('month'), parentEl: '#content', }; } function getLastSyncDate() { Reports.getLastSyncDate() .$promise.then(res => { $scope.lastSyncDate = res.lastSyncDate; }) .catch(err => { $log.error(`Error getting lastSyncDate , Error: ${JSON.stringify(err)}`); toastr.error('Opps! something went wrong'); }); } function getOfferQuantity(offer) { const mainProductQty = offer.mainProduct.totalQuantity || 0; const upsell1ProductQty = offer.upsell1.totalQuantity || 0; const upsell2ProductQty = offer.upsell2.totalQuantity || 0; const chiseledProductQty = offer.chiseled.totalQuantity || 0; return mainProductQty + upsell1ProductQty + upsell2ProductQty + chiseledProductQty; } function getOfferGrossSales(offer) { const mainProductGrossSales = offer.mainProduct.grossSales || 0; const upsell1ProductGrossSales = offer.upsell1.grossSales || 0; const upsell2ProductGrossSales = offer.upsell2.grossSales || 0; const chiseledProductGrossSales = offer.chiseled.grossSales || 0; return ( mainProductGrossSales + upsell1ProductGrossSales + upsell2ProductGrossSales + chiseledProductGrossSales ); } function getAvgSaleUnit(grossSales, quantity) { if (grossSales && quantity && quantity > 0) { return grossSales / quantity; } else { return 0; } } function getConversionOverViews(orders, views) { if (views && orders) { return (orders / views * 100).toFixed(2); } else { return 0; } } function getConversionOverOrders(orders1, orders2) { if (orders1 && orders2) { return (orders2 / orders1 * 100).toFixed(2); } else { return 0; } } function getOfferViews(offer) { return offer.mainProduct.views || 0; } function getOfferOrders(offer) { return offer.mainProduct.totalOrders || 0; } function getProductWithoutConversion(product) { return { ...product, option1: { ...product.option1, avgSaleUnit: getAvgSaleUnit(product.option1.grossSales, product.option1.totalQuantity), }, option2: { ...product.option2, avgSaleUnit: getAvgSaleUnit(product.option2.grossSales, product.option2.totalQuantity), }, option3: { ...product.option3, avgSaleUnit: getAvgSaleUnit(product.option3.grossSales, product.option3.totalQuantity), }, avgSaleUnit: getAvgSaleUnit(product.grossSales, product.totalQuantity), }; } function getMainProduct(product) { return { ...getProductWithoutConversion(product), conversion: getConversionOverViews(product.totalOrders, product.views), }; } function getUpsellProduct(product, offerOrders) { return { ...getProductWithoutConversion(product), conversion: getConversionOverOrders(offerOrders, product.totalOrders), }; } function getOffersReport(startDate, endDate) { Reports.offers({ startDate, endDate, }) .$promise.then(res => { $scope.offers = res.offersReport.map(offer => { const offerGrossSales = getOfferGrossSales(offer); const offerTotalQuantity = getOfferQuantity(offer); const offerViews = getOfferViews(offer); const offerOrders = getOfferOrders(offer); return { ...offer, mainProduct: getMainProduct(offer.mainProduct), chiseled: { ...offer.chiseled, conversion: getConversionOverOrders(offerOrders, offer.chiseled.totalOrders), avgSaleUnit: getAvgSaleUnit(offer.chiseled.grossSales, offer.chiseled.totalQuantity), }, upsell1: getUpsellProduct(offer.upsell1, offerOrders), upsell2: getUpsellProduct(offer.upsell2, offerOrders), views: offerViews, orders: offerOrders, conversion: getConversionOverViews(offerOrders, offerViews), grossSales: offerGrossSales, totalQuantity: offerTotalQuantity, avgSaleUnit: getAvgSaleUnit(offerGrossSales, offerTotalQuantity), }; }); }) .catch(err => { $log.error(`Error getting the report, Error: ${JSON.stringify(err)}`); $log.error(`Error getting the report, Error: ${err}`); toastr.error('Opps! something went wrong'); }); } $scope.refreshData = (startDate, endDate) => { getOffersReport(startDate, endDate); getLastSyncDate(); }; $scope.drillDown = row => { row.isDrilledDown = !row.isDrilledDown; }; $scope.syncWithCt = () => { Reports.syncWithCt() .$promise.then(() => { toastr.success('Sync has been scheduled. Please refresh the report after 30 seconds'); }) .catch(err => { if (err.status === 422) { toastr.error(err.data); } else { toastr.error('Opps! something went wrong'); $log.error(`Error syncing with CT , Error: ${JSON.stringify(err)}`); } }); }; function compare(field1, field2) { if (field1 > field2) { return 1; } if (field1 < field2) { return -1; } return 0; } $scope.sort = (offers, field, ascending) => { let offersSorted; if (ascending) { offersSorted = offers.sort((off1, off2) => compare(off1[field], off2[field])); } else { offersSorted = offers.sort((off1, off2) => compare(off2[field], off1[field])); } $scope.offers = offersSorted; $scope.sortBy.field = field; $scope.sortBy.ascending = ascending; }; function init() { initCalendar(); $scope.refreshData($scope.startDate, $scope.endDate); } init(); }, ]); ", } prettier-eslint [TRACE]: creating ESLint CLI Engine to get the config for "/Users/devgurus/Projects/bluestar_dashboard/src/modules/reports/client/controllers/reports.client.offers.controller.js" prettier-eslint [TRACE]: requiring eslint module at "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint/lib/api.js" prettier-eslint [DEBUG]: getting eslint config for file at "/Users/devgurus/Projects/bluestar_dashboard/src/modules/reports/client/controllers/reports.client.offers.controller.js" prettier-eslint [TRACE]: eslint config for "/Users/devgurus/Projects/bluestar_dashboard/src/modules/reports/client/controllers/reports.client.offers.controller.js" received Object { "ecmaFeatures": Object {}, "env": Object { "amd": false, "browser": true, "es6": true, "jasmine": true, "mocha": false, "node": true, }, "extends": Array [ "airbnb/base", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/es6.js", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/legacy.js", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/node.js", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/style.js", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/variables.js", ], "globals": Object { "AnalyserNode": false, "Animation": false, "AnimationEffectReadOnly": false, "AnimationEffectTiming": false, "AnimationEffectTimingReadOnly": false, "AnimationEvent": false, "AnimationPlaybackEvent": false, "AnimationTimeline": false, "ApplicationCache": false, "ApplicationCacheErrorEvent": false, "Array": false, "ArrayBuffer": false, "Attr": false, "Audio": false, "AudioBuffer": false, "AudioBufferSourceNode": false, "AudioContext": false, "AudioDestinationNode": false, "AudioListener": false, "AudioNode": false, "AudioParam": false, "AudioProcessingEvent": false, "AutocompleteErrorEvent": false, "BarProp": false, "BatteryManager": false, "BeforeUnloadEvent": false, "BiquadFilterNode": false, "Blob": false, "Boolean": false, "Buffer": false, "CDATASection": false, "CSS": false, "CSSAnimation": false, "CSSFontFaceRule": false, "CSSImportRule": false, "CSSKeyframeRule": false, "CSSKeyframesRule": false, "CSSMediaRule": false, "CSSPageRule": false, "CSSRule": false, "CSSRuleList": false, "CSSStyleDeclaration": false, "CSSStyleRule": false, "CSSStyleSheet": false, "CSSSupportsRule": false, "CSSTransition": false, "CSSUnknownRule": false, "CSSViewportRule": false, "Cache": false, "CacheStorage": false, "CanvasGradient": false, "CanvasPattern": false, "CanvasRenderingContext2D": false, "ChannelMergerNode": false, "ChannelSplitterNode": false, "CharacterData": false, "ClientRect": false, "ClientRectList": false, "ClipboardEvent": false, "CloseEvent": false, "Comment": false, "CompositionEvent": false, "ConvolverNode": false, "Credential": false, "CredentialsContainer": false, "Crypto": false, "CryptoKey": false, "CustomEvent": false, "DOMError": false, "DOMException": false, "DOMImplementation": false, "DOMParser": false, "DOMSettableTokenList": false, "DOMStringList": false, "DOMStringMap": false, "DOMTokenList": false, "DataTransfer": false, "DataTransferItem": false, "DataTransferItemList": false, "DataView": false, "Date": false, "Debug": false, "DelayNode": false, "DeviceMotionEvent": false, "DeviceOrientationEvent": false, "Document": false, "DocumentFragment": false, "DocumentTimeline": false, "DocumentType": false, "DragEvent": false, "DynamicsCompressorNode": false, "Element": false, "ElementTimeControl": false, "Error": false, "ErrorEvent": false, "EvalError": false, "Event": false, "EventSource": false, "EventTarget": false, "FederatedCredential": false, "File": false, "FileError": false, "FileList": false, "FileReader": false, "Float32Array": false, "Float64Array": false, "FocusEvent": false, "FontFace": false, "FormData": false, "Function": false, "GLOBAL": false, "GainNode": false, "Gamepad": false, "GamepadButton": false, "GamepadEvent": false, "HTMLAllCollection": false, "HTMLAnchorElement": false, "HTMLAppletElement": false, "HTMLAreaElement": false, "HTMLAudioElement": false, "HTMLBRElement": false, "HTMLBaseElement": false, "HTMLBlockquoteElement": false, "HTMLBodyElement": false, "HTMLButtonElement": false, "HTMLCanvasElement": false, "HTMLCollection": false, "HTMLContentElement": false, "HTMLDListElement": false, "HTMLDataListElement": false, "HTMLDetailsElement": false, "HTMLDialogElement": false, "HTMLDirectoryElement": false, "HTMLDivElement": false, "HTMLDocument": false, "HTMLElement": false, "HTMLEmbedElement": false, "HTMLFieldSetElement": false, "HTMLFontElement": false, "HTMLFormControlsCollection": false, "HTMLFormElement": false, "HTMLFrameElement": false, "HTMLFrameSetElement": false, "HTMLHRElement": false, "HTMLHeadElement": false, "HTMLHeadingElement": false, "HTMLHtmlElement": false, "HTMLIFrameElement": false, "HTMLImageElement": false, "HTMLInputElement": false, "HTMLIsIndexElement": false, "HTMLKeygenElement": false, "HTMLLIElement": false, "HTMLLabelElement": false, "HTMLLayerElement": false, "HTMLLegendElement": false, "HTMLLinkElement": false, "HTMLMapElement": false, "HTMLMarqueeElement": false, "HTMLMediaElement": false, "HTMLMenuElement": false, "HTMLMetaElement": false, "HTMLMeterElement": false, "HTMLModElement": false, "HTMLOListElement": false, "HTMLObjectElement": false, "HTMLOptGroupElement": false, "HTMLOptionElement": false, "HTMLOptionsCollection": false, "HTMLOutputElement": false, "HTMLParagraphElement": false, "HTMLParamElement": false, "HTMLPictureElement": false, "HTMLPreElement": false, "HTMLProgressElement": false, "HTMLQuoteElement": false, "HTMLScriptElement": false, "HTMLSelectElement": false, "HTMLShadowElement": false, "HTMLSourceElement": false, "HTMLSpanElement": false, "HTMLStyleElement": false, "HTMLTableCaptionElement": false, "HTMLTableCellElement": false, "HTMLTableColElement": false, "HTMLTableElement": false, "HTMLTableRowElement": false, "HTMLTableSectionElement": false, "HTMLTemplateElement": false, "HTMLTextAreaElement": false, "HTMLTitleElement": false, "HTMLTrackElement": false, "HTMLUListElement": false, "HTMLUnknownElement": false, "HTMLVideoElement": false, "HashChangeEvent": false, "Headers": false, "History": false, "IDBCursor": false, "IDBCursorWithValue": false, "IDBDatabase": false, "IDBEnvironment": false, "IDBFactory": false, "IDBIndex": false, "IDBKeyRange": false, "IDBObjectStore": false, "IDBOpenDBRequest": false, "IDBRequest": false, "IDBTransaction": false, "IDBVersionChangeEvent": false, "Image": false, "ImageBitmap": false, "ImageData": false, "Infinity": false, "InputEvent": false, "InputMethodContext": false, "Int16Array": false, "Int32Array": false, "Int8Array": false, "IntersectionObserver": false, "IntersectionObserverEntry": false, "Intl": false, "JSON": false, "KeyboardEvent": false, "KeyframeEffect": false, "KeyframeEffectReadOnly": false, "Location": false, "MIDIAccess": false, "MIDIConnectionEvent": false, "MIDIInput": false, "MIDIInputMap": false, "MIDIMessageEvent": false, "MIDIOutput": false, "MIDIOutputMap": false, "MIDIPort": false, "Map": false, "Math": false, "MediaElementAudioSourceNode": false, "MediaEncryptedEvent": false, "MediaError": false, "MediaKeyError": false, "MediaKeyEvent": false, "MediaKeyMessageEvent": false, "MediaKeySession": false, "MediaKeyStatusMap": false, "MediaKeySystemAccess": false, "MediaKeys": false, "MediaList": false, "MediaQueryList": false, "MediaQueryListEvent": false, "MediaSource": false, "MediaStream": false, "MediaStreamAudioDestinationNode": false, "MediaStreamAudioSourceNode": false, "MediaStreamEvent": false, "MediaStreamTrack": false, "MessageChannel": false, "MessageEvent": false, "MessagePort": false, "MimeType": false, "MimeTypeArray": false, "MouseEvent": false, "MutationEvent": false, "MutationObserver": false, "MutationRecord": false, "NaN": false, "NamedNodeMap": false, "Navigator": false, "Node": false, "NodeFilter": false, "NodeIterator": false, "NodeList": false, "Notification": false, "Number": false, "Object": false, "OfflineAudioCompletionEvent": false, "OfflineAudioContext": false, "Option": false, "OscillatorNode": false, "PageTransitionEvent": false, "PasswordCredential": false, "Path2D": false, "Performance": false, "PerformanceEntry": false, "PerformanceMark": false, "PerformanceMeasure": false, "PerformanceNavigation": false, "PerformanceResourceTiming": false, "PerformanceTiming": false, "PeriodicWave": false, "PermissionStatus": false, "Permissions": false, "Plugin": false, "PluginArray": false, "PopStateEvent": false, "ProcessingInstruction": false, "ProgressEvent": false, "Promise": false, "PromiseRejectionEvent": false, "Proxy": false, "PushManager": false, "PushSubscription": false, "RTCIceCandidate": false, "RTCPeerConnection": false, "RTCSessionDescription": false, "RadioNodeList": false, "Range": false, "RangeError": false, "ReadableByteStream": false, "ReadableStream": false, "ReferenceError": false, "Reflect": false, "RegExp": false, "Request": false, "Response": false, "SVGAElement": false, "SVGAltGlyphDefElement": false, "SVGAltGlyphElement": false, "SVGAltGlyphItemElement": false, "SVGAngle": false, "SVGAnimateColorElement": false, "SVGAnimateElement": false, "SVGAnimateMotionElement": false, "SVGAnimateTransformElement": false, "SVGAnimatedAngle": false, "SVGAnimatedBoolean": false, "SVGAnimatedEnumeration": false, "SVGAnimatedInteger": false, "SVGAnimatedLength": false, "SVGAnimatedLengthList": false, "SVGAnimatedNumber": false, "SVGAnimatedNumberList": false, "SVGAnimatedPathData": false, "SVGAnimatedPoints": false, "SVGAnimatedPreserveAspectRatio": false, "SVGAnimatedRect": false, "SVGAnimatedString": false, "SVGAnimatedTransformList": false, "SVGAnimationElement": false, "SVGCSSRule": false, "SVGCircleElement": false, "SVGClipPathElement": false, "SVGColor": false, "SVGColorProfileElement": false, "SVGColorProfileRule": false, "SVGComponentTransferFunctionElement": false, "SVGCursorElement": false, "SVGDefsElement": false, "SVGDescElement": false, "SVGDiscardElement": false, "SVGDocument": false, "SVGElement": false, "SVGElementInstance": false, "SVGElementInstanceList": false, "SVGEllipseElement": false, "SVGEvent": false, "SVGExternalResourcesRequired": false, "SVGFEBlendElement": false, "SVGFEColorMatrixElement": false, "SVGFEComponentTransferElement": false, "SVGFECompositeElement": false, "SVGFEConvolveMatrixElement": false, "SVGFEDiffuseLightingElement": false, "SVGFEDisplacementMapElement": false, "SVGFEDistantLightElement": false, "SVGFEDropShadowElement": false, "SVGFEFloodElement": false, "SVGFEFuncAElement": false, "SVGFEFuncBElement": false, "SVGFEFuncGElement": false, "SVGFEFuncRElement": false, "SVGFEGaussianBlurElement": false, "SVGFEImageElement": false, "SVGFEMergeElement": false, "SVGFEMergeNodeElement": false, "SVGFEMorphologyElement": false, "SVGFEOffsetElement": false, "SVGFEPointLightElement": false, "SVGFESpecularLightingElement": false, "SVGFESpotLightElement": false, "SVGFETileElement": false, "SVGFETurbulenceElement": false, "SVGFilterElement": false, "SVGFilterPrimitiveStandardAttributes": false, "SVGFitToViewBox": false, "SVGFontElement": false, "SVGFontFaceElement": false, "SVGFontFaceFormatElement": false, "SVGFontFaceNameElement": false, "SVGFontFaceSrcElement": false, "SVGFontFaceUriElement": false, "SVGForeignObjectElement": false, "SVGGElement": false, "SVGGeometryElement": false, "SVGGlyphElement": false, "SVGGlyphRefElement": false, "SVGGradientElement": false, "SVGGraphicsElement": false, "SVGHKernElement": false, "SVGICCColor": false, "SVGImageElement": false, "SVGLangSpace": false, "SVGLength": false, "SVGLengthList": false, "SVGLineElement": false, "SVGLinearGradientElement": false, "SVGLocatable": false, "SVGMPathElement": false, "SVGMarkerElement": false, "SVGMaskElement": false, "SVGMatrix": false, "SVGMetadataElement": false, "SVGMissingGlyphElement": false, "SVGNumber": false, "SVGNumberList": false, "SVGPaint": false, "SVGPathElement": false, "SVGPathSeg": false, "SVGPathSegArcAbs": false, "SVGPathSegArcRel": false, "SVGPathSegClosePath": false, "SVGPathSegCurvetoCubicAbs": false, "SVGPathSegCurvetoCubicRel": false, "SVGPathSegCurvetoCubicSmoothAbs": false, "SVGPathSegCurvetoCubicSmoothRel": false, "SVGPathSegCurvetoQuadraticAbs": false, "SVGPathSegCurvetoQuadraticRel": false, "SVGPathSegCurvetoQuadraticSmoothAbs": false, "SVGPathSegCurvetoQuadraticSmoothRel": false, "SVGPathSegLinetoAbs": false, "SVGPathSegLinetoHorizontalAbs": false, "SVGPathSegLinetoHorizontalRel": false, "SVGPathSegLinetoRel": false, "SVGPathSegLinetoVerticalAbs": false, "SVGPathSegLinetoVerticalRel": false, "SVGPathSegList": false, "SVGPathSegMovetoAbs": false, "SVGPathSegMovetoRel": false, "SVGPatternElement": false, "SVGPoint": false, "SVGPointList": false, "SVGPolygonElement": false, "SVGPolylineElement": false, "SVGPreserveAspectRatio": false, "SVGRadialGradientElement": false, "SVGRect": false, "SVGRectElement": false, "SVGRenderingIntent": false, "SVGSVGElement": false, "SVGScriptElement": false, "SVGSetElement": false, "SVGStopElement": false, "SVGStringList": false, "SVGStylable": false, "SVGStyleElement": false, "SVGSwitchElement": false, "SVGSymbolElement": false, "SVGTRefElement": false, "SVGTSpanElement": false, "SVGTests": false, "SVGTextContentElement": false, "SVGTextElement": false, "SVGTextPathElement": false, "SVGTextPositioningElement": false, "SVGTitleElement": false, "SVGTransform": false, "SVGTransformList": false, "SVGTransformable": false, "SVGURIReference": false, "SVGUnitTypes": false, "SVGUseElement": false, "SVGVKernElement": false, "SVGViewElement": false, "SVGViewSpec": false, "SVGZoomAndPan": false, "SVGZoomEvent": false, "Screen": false, "ScreenOrientation": false, "ScriptProcessorNode": false, "SecurityPolicyViolationEvent": false, "Selection": false, "ServiceWorker": false, "ServiceWorkerContainer": false, "ServiceWorkerRegistration": false, "Set": false, "ShadowRoot": false, "SharedKeyframeList": false, "SharedWorker": false, "SiteBoundCredential": false, "SpeechSynthesisEvent": false, "SpeechSynthesisUtterance": false, "Storage": false, "StorageEvent": false, "String": false, "StyleSheet": false, "StyleSheetList": false, "SubtleCrypto": false, "Symbol": false, "SyntaxError": false, "System": false, "Text": false, "TextDecoder": false, "TextEncoder": false, "TextEvent": false, "TextMetrics": false, "TextTrack": false, "TextTrackCue": false, "TextTrackCueList": false, "TextTrackList": false, "TimeEvent": false, "TimeRanges": false, "Touch": false, "TouchEvent": false, "TouchList": false, "TrackEvent": false, "TransitionEvent": false, "TreeWalker": false, "TypeError": false, "UIEvent": false, "URIError": false, "URL": false, "URLSearchParams": false, "Uint16Array": false, "Uint32Array": false, "Uint8Array": false, "Uint8ClampedArray": false, "VTTCue": false, "ValidityState": false, "WaveShaperNode": false, "WeakMap": false, "WeakSet": false, "WebGLActiveInfo": false, "WebGLBuffer": false, "WebGLContextEvent": false, "WebGLFramebuffer": false, "WebGLProgram": false, "WebGLRenderbuffer": false, "WebGLRenderingContext": false, "WebGLShader": false, "WebGLShaderPrecisionFormat": false, "WebGLTexture": false, "WebGLUniformLocation": false, "WebSocket": false, "WheelEvent": false, "Window": false, "Worker": false, "XDomainRequest": false, "XMLDocument": false, "XMLHttpRequest": false, "XMLHttpRequestEventTarget": false, "XMLHttpRequestProgressEvent": false, "XMLHttpRequestUpload": false, "XMLSerializer": false, "XPathEvaluator": false, "XPathException": false, "XPathExpression": false, "XPathNSResolver": false, "XPathNamespace": false, "XPathResult": false, "XSLTProcessor": false, "__dirname": false, "__filename": false, "addEventListener": false, "afterAll": false, "afterEach": false, "alert": false, "applicationCache": false, "arguments": false, "atob": false, "beforeAll": false, "beforeEach": false, "blur": false, "btoa": false, "caches": false, "cancelAnimationFrame": false, "clearImmediate": false, "clearInterval": false, "clearTimeout": false, "clientInformation": false, "close": false, "closed": false, "confirm": false, "console": false, "constructor": false, "crypto": false, "customElements": false, "decodeURI": false, "decodeURIComponent": false, "defaultStatus": false, "defaultstatus": false, "describe": false, "devicePixelRatio": false, "dispatchEvent": false, "document": false, "encodeURI": false, "encodeURIComponent": false, "escape": false, "eval": false, "event": false, "expect": false, "exports": true, "external": false, "fail": false, "fdescribe": false, "fetch": false, "find": false, "fit": false, "focus": false, "frameElement": false, "frames": false, "getComputedStyle": false, "getSelection": false, "global": false, "hasOwnProperty": false, "history": false, "indexedDB": false, "innerHeight": false, "innerWidth": false, "isFinite": false, "isNaN": false, "isPrototypeOf": false, "it": false, "jasmine": false, "length": false, "localStorage": false, "location": false, "locationbar": false, "matchMedia": false, "menubar": false, "module": false, "moveBy": false, "moveTo": false, "name": false, "navigator": false, "offscreenBuffering": false, "onbeforeunload": true, "onblur": true, "onerror": true, "onfocus": true, "onload": true, "onresize": true, "onunload": true, "open": false, "openDatabase": false, "opener": false, "opera": false, "outerHeight": false, "outerWidth": false, "pageXOffset": false, "pageYOffset": false, "parent": false, "parseFloat": false, "parseInt": false, "pending": false, "performance": false, "personalbar": false, "postMessage": false, "print": false, "process": false, "prompt": false, "propertyIsEnumerable": false, "removeEventListener": false, "requestAnimationFrame": false, "requestIdleCallback": false, "require": false, "resizeBy": false, "resizeTo": false, "root": false, "runs": false, "screen": false, "screenLeft": false, "screenTop": false, "screenX": false, "screenY": false, "scroll": false, "scrollBy": false, "scrollTo": false, "scrollX": false, "scrollY": false, "scrollbars": false, "self": false, "sessionStorage": false, "setImmediate": false, "setInterval": false, "setTimeout": false, "showModalDialog": false, "speechSynthesis": false, "spyOn": false, "status": false, "statusbar": false, "stop": false, "styleMedia": false, "toLocaleString": false, "toString": false, "toolbar": false, "top": false, "undefined": false, "unescape": false, "valueOf": false, "waits": false, "waitsFor": false, "window": false, "xdescribe": false, "xit": false, }, "parser": "", "parserOptions": Object { "ecmaFeatures": Object { "experimentalObjectRestSpread": true, "generators": false, "globalReturn": true, "objectLiteralDuplicateProperties": false, }, "ecmaVersion": 6, "sourceType": "module", }, "plugins": Array [ "import", "jasmine", ], "rules": Object { "accessor-pairs": 0, "array-bracket-spacing": Array [ 2, "never", ], "array-callback-return": 2, "arrow-body-style": Array [ "off", "as-needed", ], "arrow-parens": 0, "arrow-spacing": Array [ 2, Object { "after": true, "before": true, }, ], "block-scoped-var": 2, "block-spacing": Array [ 2, "always", ], "brace-style": Array [ 2, "1tbs", Object { "allowSingleLine": true, }, ], "callback-return": 0, "camelcase": Array [ 2, Object { "properties": "never", }, ], "comma-dangle": Array [ 2, "always-multiline", ], "comma-spacing": Array [ 2, Object { "after": true, "before": false, }, ], "comma-style": Array [ 2, "last", ], "complexity": Array [ 0, 11, ], "computed-property-spacing": Array [ 2, "never", ], "consistent-return": "off", "consistent-this": 0, "constructor-super": 0, "curly": Array [ 2, "multi-line", ], "default-case": Array [ 2, Object { "commentPattern": "^no default$", }, ], "dot-location": 0, "dot-notation": Array [ 2, Object { "allowKeywords": true, }, ], "eol-last": 2, "eqeqeq": Array [ 2, "allow-null", ], "func-names": 1, "func-style": 0, "generator-star-spacing": 0, "global-require": "off", "guard-for-in": 2, "handle-callback-err": 0, "id-blacklist": 0, "id-length": 0, "id-match": 0, "import/default": 0, "import/export": 2, "import/extensions": Array [ 0, "never", ], "import/imports-first": Array [ 0, "absolute-first", ], "import/named": 0, "import/namespace": 0, "import/newline-after-import": 0, "import/no-amd": 2, "import/no-commonjs": 0, "import/no-deprecated": 0, "import/no-duplicates": 2, "import/no-extraneous-dependencies": Array [ 0, Object { "devDependencies": false, "optionalDependencies": false, }, ], "import/no-mutable-exports": 2, "import/no-named-as-default": 0, "import/no-named-as-default-member": 0, "import/no-namespace": 0, "import/no-nodejs-modules": 0, "import/no-unresolved": Array [ 2, Object { "commonjs": true, }, ], "import/order": Array [ 0, Object { "groups": Array [ "builtin", "external", "internal", "parent", "sibling", "index", ], "newlines-between": "never", }, ], "indent": Array [ "warn", 2, Object { "SwitchCase": 1, "VariableDeclarator": 1, }, ], "init-declarations": 0, "jsx-quotes": 0, "key-spacing": Array [ 2, Object { "afterColon": true, "beforeColon": false, }, ], "keyword-spacing": Array [ 2, Object { "after": true, "before": true, "overrides": Object { "case": Object { "after": true, }, "return": Object { "after": true, }, "throw": Object { "after": true, }, }, }, ], "linebreak-style": 0, "lines-around-comment": 0, "max-depth": Array [ 0, 4, ], "max-len": Array [ 2, 100, 2, Object { "ignoreComments": false, "ignoreUrls": true, }, ], "max-nested-callbacks": 0, "max-params": Array [ 0, 3, ], "max-statements": Array [ 0, 10, ], "max-statements-per-line": Array [ 0, Object { "max": 1, }, ], "new-cap": Array [ "off", Object { "newIsCap": true, }, ], "new-parens": 0, "newline-after-var": 0, "newline-before-return": 0, "newline-per-chained-call": Array [ 2, Object { "ignoreChainWithDepth": 3, }, ], "no-alert": 1, "no-array-constructor": 2, "no-bitwise": 0, "no-caller": 2, "no-case-declarations": 2, "no-catch-shadow": 0, "no-class-assign": 2, "no-cond-assign": Array [ 2, "always", ], "no-confusing-arrow": Array [ 2, Object { "allowParens": true, }, ], "no-console": "off", "no-const-assign": 2, "no-constant-condition": 1, "no-continue": 0, "no-control-regex": 2, "no-debugger": 2, "no-delete-var": 2, "no-div-regex": 0, "no-dupe-args": 2, "no-dupe-class-members": 2, "no-dupe-keys": 2, "no-duplicate-case": 2, "no-duplicate-imports": 2, "no-else-return": "off", "no-empty": 2, "no-empty-character-class": 2, "no-empty-function": Array [ 2, Object { "allow": Array [ "arrowFunctions", "functions", "methods", ], }, ], "no-empty-pattern": 2, "no-eq-null": 0, "no-eval": 2, "no-ex-assign": 2, "no-extend-native": 2, "no-extra-bind": 2, "no-extra-boolean-cast": 0, "no-extra-label": 2, "no-extra-parens": Array [ 0, "all", Object { "conditionalAssign": true, "nestedBinaryExpressions": false, }, ], "no-extra-semi": 2, "no-fallthrough": 2, "no-floating-decimal": 2, "no-func-assign": 2, "no-implicit-coercion": 0, "no-implicit-globals": 0, "no-implied-eval": 2, "no-inline-comments": 0, "no-inner-declarations": 2, "no-invalid-regexp": 2, "no-invalid-this": 0, "no-irregular-whitespace": 2, "no-iterator": 2, "no-label-var": 0, "no-labels": Array [ 2, Object { "allowLoop": false, "allowSwitch": false, }, ], "no-lone-blocks": 2, "no-lonely-if": 0, "no-loop-func": 2, "no-magic-numbers": Array [ 0, Object { "detectObjects": false, "enforceConst": true, "ignore": Array [], "ignoreArrayIndexes": true, }, ], "no-mixed-requires": Array [ 0, false, ], "no-mixed-spaces-and-tabs": 2, "no-multi-spaces": 2, "no-multi-str": 2, "no-multiple-empty-lines": Array [ 2, Object { "max": 2, "maxEOF": 1, }, ], "no-native-reassign": 2, "no-negated-condition": 0, "no-negated-in-lhs": 2, "no-nested-ternary": 2, "no-new": 2, "no-new-func": 2, "no-new-object": 2, "no-new-require": 0, "no-new-symbol": 2, "no-new-wrappers": 2, "no-obj-calls": 2, "no-octal": 2, "no-octal-escape": 2, "no-param-reassign": Array [ "error", Object { "props": false, }, ], "no-path-concat": 0, "no-plusplus": 0, "no-process-env": 0, "no-process-exit": 0, "no-proto": 2, "no-redeclare": 2, "no-regex-spaces": 2, "no-restricted-globals": 0, "no-restricted-imports": 0, "no-restricted-modules": 0, "no-restricted-syntax": Array [ 2, "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement", ], "no-return-assign": 2, "no-script-url": 2, "no-self-assign": 2, "no-self-compare": 2, "no-sequences": 2, "no-shadow": 2, "no-shadow-restricted-names": 2, "no-spaced-func": 2, "no-sparse-arrays": 2, "no-sync": 0, "no-ternary": 0, "no-this-before-super": 0, "no-throw-literal": 2, "no-trailing-spaces": 2, "no-undef": 2, "no-undef-init": 0, "no-undefined": 0, "no-underscore-dangle": Array [ 2, Object { "allowAfterThis": false, }, ], "no-unexpected-multiline": 0, "no-unmodified-loop-condition": 0, "no-unneeded-ternary": Array [ 2, Object { "defaultAssignment": false, }, ], "no-unreachable": 2, "no-unsafe-finally": 2, "no-unused-expressions": 2, "no-unused-labels": 2, "no-unused-vars": Array [ "warn", Object { "args": "after-used", "vars": "local", }, ], "no-use-before-define": 2, "no-useless-call": 0, "no-useless-computed-key": 2, "no-useless-concat": 2, "no-useless-constructor": 2, "no-useless-escape": 2, "no-var": 2, "no-void": 0, "no-warning-comments": Array [ 0, Object { "location": "start", "terms": Array [ "todo", "fixme", "xxx", ], }, ], "no-whitespace-before-property": 2, "no-with": 2, "object-curly-spacing": Array [ 2, "always", ], "object-shorthand": Array [ 2, "always", ], "one-var": Array [ 2, "never", ], "one-var-declaration-per-line": Array [ 2, "always", ], "operator-assignment": 0, "operator-linebreak": 0, "padded-blocks": Array [ 2, "never", ], "prefer-arrow-callback": Array [ 2, Object { "allowNamedFunctions": false, "allowUnboundThis": true, }, ], "prefer-const": 2, "prefer-reflect": 0, "prefer-rest-params": 2, "prefer-spread": 0, "prefer-template": 2, "quote-props": Array [ 2, "as-needed", Object { "keywords": false, "numbers": false, "unnecessary": true, }, ], "quotes": Array [ 2, "single", "avoid-escape", ], "radix": 2, "require-jsdoc": 0, "require-yield": 0, "semi": Array [ 2, "always", ], "semi-spacing": Array [ 2, Object { "after": true, "before": false, }, ], "sort-imports": 0, "sort-vars": 0, "space-before-blocks": 2, "space-before-function-paren": Array [ 2, Object { "anonymous": "always", "named": "never", }, ], "space-in-parens": Array [ 2, "never", ], "space-infix-ops": 2, "space-unary-ops": 0, "spaced-comment": Array [ 2, "always", Object { "exceptions": Array [ "-", "+", ], "markers": Array [ "=", "!", ], }, ], "strict": 2, "template-curly-spacing": 2, "use-isnan": 2, "valid-jsdoc": 0, "valid-typeof": 2, "vars-on-top": 2, "wrap-iife": Array [ 2, "outside", ], "wrap-regex": 0, "yield-star-spacing": Array [ 2, "after", ], "yoda": 2, }, "settings": Object { "import/resolver": Object { "node": Object { "extensions": Array [ ".js", ".json", ], }, }, }, } prettier-eslint [DEBUG]: reducing eslint rules down to relevant rules only prettier-eslint [TRACE]: adding to relevant rules: {"accessor-pairs":0} prettier-eslint [TRACE]: adding to relevant rules: {"array-callback-return":2} prettier-eslint [TRACE]: adding to relevant rules: {"block-scoped-var":2} prettier-eslint [TRACE]: adding to relevant rules: {"complexity":[0,11]} prettier-eslint [TRACE]: adding to relevant rules: {"consistent-return":"off"} prettier-eslint [TRACE]: adding to relevant rules: {"curly":[2,"multi-line"]} prettier-eslint [TRACE]: adding to relevant rules: {"default-case":[2,{"commentPattern":"^no default$"}]} prettier-eslint [TRACE]: adding to relevant rules: {"dot-notation":[2,{"allowKeywords":true}]} prettier-eslint [TRACE]: adding to relevant rules: {"dot-location":0} prettier-eslint [TRACE]: adding to relevant rules: {"eqeqeq":[2,"allow-null"]} prettier-eslint [TRACE]: adding to relevant rules: {"guard-for-in":2} prettier-eslint [TRACE]: adding to relevant rules: {"id-blacklist":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-alert":1} prettier-eslint [TRACE]: adding to relevant rules: {"no-caller":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-case-declarations":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-div-regex":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-else-return":"off"} prettier-eslint [TRACE]: adding to relevant rules: {"no-empty-function":[2,{"allow":["arrowFunctions","functions","methods"]}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-empty-pattern":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-extra-label":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-eq-null":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-eval":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-extend-native":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-extra-bind":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-fallthrough":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-floating-decimal":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-implicit-coercion":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-implied-eval":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-invalid-this":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-iterator":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-labels":[2,{"allowLoop":false,"allowSwitch":false}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-lone-blocks":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-loop-func":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-magic-numbers":[0,{"ignore":[],"ignoreArrayIndexes":true,"enforceConst":true,"detectObjects":false}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-multi-spaces":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-multi-str":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-native-reassign":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-new":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-new-func":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-new-wrappers":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-octal":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-octal-escape":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-param-reassign":["error",{"props":false}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-process-env":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-proto":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-redeclare":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-restricted-syntax":[2,"DebuggerStatement","ForInStatement","LabeledStatement","WithStatement"]} prettier-eslint [TRACE]: adding to relevant rules: {"no-return-assign":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-script-url":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-self-compare":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-sequences":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-throw-literal":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-unmodified-loop-condition":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-unsafe-finally":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-unused-expressions":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-unused-labels":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-useless-call":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-useless-concat":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-useless-escape":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-void":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-warning-comments":[0,{"terms":["todo","fixme","xxx"],"location":"start"}]} prettier-eslint [TRACE]: omitting from relevant rules: {"no-with":2} prettier-eslint [TRACE]: adding to relevant rules: {"radix":2} prettier-eslint [TRACE]: adding to relevant rules: {"vars-on-top":2} prettier-eslint [TRACE]: adding to relevant rules: {"wrap-iife":[2,"outside"]} prettier-eslint [TRACE]: adding to relevant rules: {"yoda":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-cond-assign":[2,"always"]} prettier-eslint [TRACE]: adding to relevant rules: {"no-console":"off"} prettier-eslint [TRACE]: adding to relevant rules: {"no-constant-condition":1} prettier-eslint [TRACE]: adding to relevant rules: {"no-control-regex":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-debugger":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-dupe-args":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-dupe-keys":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-duplicate-case":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-empty-character-class":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-empty":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-ex-assign":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-extra-boolean-cast":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-extra-parens":[0,"all",{"conditionalAssign":true,"nestedBinaryExpressions":false}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-extra-semi":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-func-assign":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-inner-declarations":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-invalid-regexp":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-irregular-whitespace":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-negated-in-lhs":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-obj-calls":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-regex-spaces":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-sparse-arrays":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-unreachable":2} prettier-eslint [TRACE]: adding to relevant rules: {"use-isnan":2} prettier-eslint [TRACE]: omitting from relevant rules: {"valid-jsdoc":0} prettier-eslint [TRACE]: adding to relevant rules: {"valid-typeof":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-unexpected-multiline":0} prettier-eslint [TRACE]: adding to relevant rules: {"comma-dangle":[2,"always-multiline"]} prettier-eslint [TRACE]: adding to relevant rules: {"max-depth":[0,4]} prettier-eslint [TRACE]: adding to relevant rules: {"max-params":[0,3]} prettier-eslint [TRACE]: adding to relevant rules: {"max-statements":[0,10]} prettier-eslint [TRACE]: adding to relevant rules: {"no-bitwise":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-plusplus":0} prettier-eslint [TRACE]: adding to relevant rules: {"callback-return":0} prettier-eslint [TRACE]: omitting from relevant rules: {"global-require":"off"} prettier-eslint [TRACE]: adding to relevant rules: {"handle-callback-err":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-mixed-requires":[0,false]} prettier-eslint [TRACE]: adding to relevant rules: {"no-new-require":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-path-concat":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-process-exit":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-restricted-modules":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-sync":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-unresolved":[2,{"commonjs":true}]} prettier-eslint [TRACE]: adding to relevant rules: {"array-bracket-spacing":[2,"never"]} prettier-eslint [TRACE]: adding to relevant rules: {"block-spacing":[2,"always"]} prettier-eslint [TRACE]: adding to relevant rules: {"brace-style":[2,"1tbs",{"allowSingleLine":true}]} prettier-eslint [TRACE]: adding to relevant rules: {"camelcase":[2,{"properties":"never"}]} prettier-eslint [TRACE]: adding to relevant rules: {"comma-spacing":[2,{"before":false,"after":true}]} prettier-eslint [TRACE]: adding to relevant rules: {"comma-style":[2,"last"]} prettier-eslint [TRACE]: adding to relevant rules: {"computed-property-spacing":[2,"never"]} prettier-eslint [TRACE]: adding to relevant rules: {"consistent-this":0} prettier-eslint [TRACE]: adding to relevant rules: {"eol-last":2} prettier-eslint [TRACE]: adding to relevant rules: {"func-names":1} prettier-eslint [TRACE]: adding to relevant rules: {"func-style":0} prettier-eslint [TRACE]: adding to relevant rules: {"id-length":0} prettier-eslint [TRACE]: adding to relevant rules: {"indent":["warn",2,{"SwitchCase":1,"VariableDeclarator":1}]} prettier-eslint [TRACE]: adding to relevant rules: {"jsx-quotes":0} prettier-eslint [TRACE]: adding to relevant rules: {"key-spacing":[2,{"beforeColon":false,"afterColon":true}]} prettier-eslint [TRACE]: adding to relevant rules: {"keyword-spacing":[2,{"before":true,"after":true,"overrides":{"return":{"after":true},"throw":{"after":true},"case":{"after":true}}}]} prettier-eslint [TRACE]: adding to relevant rules: {"lines-around-comment":0} prettier-eslint [TRACE]: adding to relevant rules: {"linebreak-style":0} prettier-eslint [TRACE]: adding to relevant rules: {"max-len":[2,100,2,{"ignoreUrls":true,"ignoreComments":false}]} prettier-eslint [TRACE]: adding to relevant rules: {"max-nested-callbacks":0} prettier-eslint [TRACE]: adding to relevant rules: {"max-statements-per-line":[0,{"max":1}]} prettier-eslint [TRACE]: adding to relevant rules: {"new-cap":["off",{"newIsCap":true}]} prettier-eslint [TRACE]: adding to relevant rules: {"new-parens":0} prettier-eslint [TRACE]: adding to relevant rules: {"newline-after-var":0} prettier-eslint [TRACE]: adding to relevant rules: {"newline-before-return":0} prettier-eslint [TRACE]: adding to relevant rules: {"newline-per-chained-call":[2,{"ignoreChainWithDepth":3}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-array-constructor":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-continue":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-inline-comments":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-lonely-if":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-mixed-spaces-and-tabs":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-multiple-empty-lines":[2,{"max":2,"maxEOF":1}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-negated-condition":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-nested-ternary":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-new-object":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-spaced-func":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-ternary":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-trailing-spaces":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-underscore-dangle":[2,{"allowAfterThis":false}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-unneeded-ternary":[2,{"defaultAssignment":false}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-whitespace-before-property":2} prettier-eslint [TRACE]: adding to relevant rules: {"object-curly-spacing":[2,"always"]} prettier-eslint [TRACE]: adding to relevant rules: {"one-var":[2,"never"]} prettier-eslint [TRACE]: adding to relevant rules: {"one-var-declaration-per-line":[2,"always"]} prettier-eslint [TRACE]: adding to relevant rules: {"operator-assignment":0} prettier-eslint [TRACE]: adding to relevant rules: {"operator-linebreak":0} prettier-eslint [TRACE]: adding to relevant rules: {"padded-blocks":[2,"never"]} prettier-eslint [TRACE]: adding to relevant rules: {"quote-props":[2,"as-needed",{"keywords":false,"unnecessary":true,"numbers":false}]} prettier-eslint [TRACE]: adding to relevant rules: {"quotes":[2,"single","avoid-escape"]} prettier-eslint [TRACE]: adding to relevant rules: {"id-match":0} prettier-eslint [TRACE]: adding to relevant rules: {"require-jsdoc":0} prettier-eslint [TRACE]: adding to relevant rules: {"semi-spacing":[2,{"before":false,"after":true}]} prettier-eslint [TRACE]: adding to relevant rules: {"semi":[2,"always"]} prettier-eslint [TRACE]: adding to relevant rules: {"sort-vars":0} prettier-eslint [TRACE]: adding to relevant rules: {"space-before-blocks":2} prettier-eslint [TRACE]: adding to relevant rules: {"space-before-function-paren":[2,{"anonymous":"always","named":"never"}]} prettier-eslint [TRACE]: adding to relevant rules: {"space-in-parens":[2,"never"]} prettier-eslint [TRACE]: adding to relevant rules: {"space-infix-ops":2} prettier-eslint [TRACE]: adding to relevant rules: {"space-unary-ops":0} prettier-eslint [TRACE]: adding to relevant rules: {"spaced-comment":[2,"always",{"exceptions":["-","+"],"markers":["=","!"]}]} prettier-eslint [TRACE]: adding to relevant rules: {"wrap-regex":0} prettier-eslint [TRACE]: adding to relevant rules: {"init-declarations":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-catch-shadow":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-delete-var":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-implicit-globals":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-label-var":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-self-assign":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-shadow-restricted-names":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-shadow":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-undef-init":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-undef":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-undefined":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-unused-vars":["warn",{"vars":"local","args":"after-used"}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-use-before-define":2} prettier-eslint [TRACE]: adding to relevant rules: {"arrow-body-style":["off","as-needed"]} prettier-eslint [TRACE]: adding to relevant rules: {"arrow-parens":0} prettier-eslint [TRACE]: adding to relevant rules: {"arrow-spacing":[2,{"before":true,"after":true}]} prettier-eslint [TRACE]: adding to relevant rules: {"constructor-super":0} prettier-eslint [TRACE]: adding to relevant rules: {"generator-star-spacing":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-class-assign":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-confusing-arrow":[2,{"allowParens":true}]} prettier-eslint [TRACE]: adding to relevant rules: {"no-const-assign":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-dupe-class-members":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-duplicate-imports":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-new-symbol":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-restricted-globals":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-restricted-imports":0} prettier-eslint [TRACE]: adding to relevant rules: {"no-this-before-super":0} prettier-eslint [TRACE]: omitting from relevant rules: {"no-var":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-useless-computed-key":2} prettier-eslint [TRACE]: adding to relevant rules: {"no-useless-constructor":2} prettier-eslint [TRACE]: adding to relevant rules: {"object-shorthand":[2,"always"]} prettier-eslint [TRACE]: adding to relevant rules: {"prefer-arrow-callback":[2,{"allowNamedFunctions":false,"allowUnboundThis":true}]} prettier-eslint [TRACE]: omitting from relevant rules: {"prefer-const":2} prettier-eslint [TRACE]: adding to relevant rules: {"prefer-spread":0} prettier-eslint [TRACE]: adding to relevant rules: {"prefer-reflect":0} prettier-eslint [TRACE]: adding to relevant rules: {"prefer-rest-params":2} prettier-eslint [TRACE]: adding to relevant rules: {"prefer-template":2} prettier-eslint [TRACE]: adding to relevant rules: {"require-yield":0} prettier-eslint [TRACE]: adding to relevant rules: {"sort-imports":0} prettier-eslint [TRACE]: adding to relevant rules: {"template-curly-spacing":2} prettier-eslint [TRACE]: adding to relevant rules: {"yield-star-spacing":[2,"after"]} prettier-eslint [TRACE]: adding to relevant rules: {"import/export":2} prettier-eslint [TRACE]: adding to relevant rules: {"import/default":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/extensions":[0,"never"]} prettier-eslint [TRACE]: adding to relevant rules: {"import/named":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/namespace":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-extraneous-dependencies":[0,{"devDependencies":false,"optionalDependencies":false}]} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-named-as-default":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-commonjs":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-amd":2} prettier-eslint [TRACE]: adding to relevant rules: {"import/imports-first":[0,"absolute-first"]} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-duplicates":2} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-deprecated":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-namespace":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-named-as-default-member":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-nodejs-modules":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/order":[0,{"groups":["builtin","external","internal","parent","sibling","index"],"newlines-between":"never"}]} prettier-eslint [TRACE]: adding to relevant rules: {"import/newline-after-import":0} prettier-eslint [TRACE]: adding to relevant rules: {"import/no-mutable-exports":2} prettier-eslint [TRACE]: adding to relevant rules: {"strict":2} prettier-eslint [TRACE]: The max-len rule is configured with a non-object value of 100. Using that value. prettier-eslint [TRACE]: The indent rule is configured with a non-object value of 2. Using that value. prettier-eslint [DEBUG]: The parser rule is not configured, using default of babylon prettier-eslint [TRACE]: The quotes rule is configured with a non-object value of single. Using that value. prettier-eslint [TRACE]: The comma-dangle rule is configured with a non-object value of always-multiline. Using that value. prettier-eslint [TRACE]: The object-curly-spacing rule is configured with a non-object value of always. Using that value. prettier-eslint [TRACE]: The semi rule is configured with a non-object value of always. Using that value. prettier-eslint [TRACE]: The indent rule is configured with a non-object value of 2. Using that value. prettier-eslint [DEBUG]: The useTabs rule is not configured, using default of false prettier-eslint [DEBUG]: inferred options: Object { "eslintConfig": Object { "ecmaFeatures": Object {}, "env": Object { "amd": false, "browser": true, "es6": true, "jasmine": true, "mocha": false, "node": true, }, "extends": Array [ "airbnb/base", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/es6.js", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/legacy.js", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/node.js", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/style.js", "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint-config-airbnb-base/rules/variables.js", ], "fix": true, "globals": Array [], "parser": "", "parserOptions": Object { "ecmaFeatures": Object { "experimentalObjectRestSpread": true, "generators": false, "globalReturn": true, "objectLiteralDuplicateProperties": false, }, "ecmaVersion": 6, "sourceType": "module", }, "plugins": Array [ "import", "jasmine", ], "rules": Object { "accessor-pairs": 0, "array-bracket-spacing": Array [ 2, "never", ], "array-callback-return": 2, "arrow-body-style": Array [ "off", "as-needed", ], "arrow-parens": 0, "arrow-spacing": Array [ 2, Object { "after": true, "before": true, }, ], "block-scoped-var": 2, "block-spacing": Array [ 2, "always", ], "brace-style": Array [ 2, "1tbs", Object { "allowSingleLine": true, }, ], "callback-return": 0, "camelcase": Array [ 2, Object { "properties": "never", }, ], "comma-dangle": Array [ 2, "always-multiline", ], "comma-spacing": Array [ 2, Object { "after": true, "before": false, }, ], "comma-style": Array [ 2, "last", ], "complexity": Array [ 0, 11, ], "computed-property-spacing": Array [ 2, "never", ], "consistent-return": "off", "consistent-this": 0, "constructor-super": 0, "curly": Array [ 2, "multi-line", ], "default-case": Array [ 2, Object { "commentPattern": "^no default$", }, ], "dot-location": 0, "dot-notation": Array [ 2, Object { "allowKeywords": true, }, ], "eol-last": 2, "eqeqeq": Array [ 2, "allow-null", ], "func-names": 1, "func-style": 0, "generator-star-spacing": 0, "guard-for-in": 2, "handle-callback-err": 0, "id-blacklist": 0, "id-length": 0, "id-match": 0, "import/default": 0, "import/export": 2, "import/extensions": Array [ 0, "never", ], "import/imports-first": Array [ 0, "absolute-first", ], "import/named": 0, "import/namespace": 0, "import/newline-after-import": 0, "import/no-amd": 2, "import/no-commonjs": 0, "import/no-deprecated": 0, "import/no-duplicates": 2, "import/no-extraneous-dependencies": Array [ 0, Object { "devDependencies": false, "optionalDependencies": false, }, ], "import/no-mutable-exports": 2, "import/no-named-as-default": 0, "import/no-named-as-default-member": 0, "import/no-namespace": 0, "import/no-nodejs-modules": 0, "import/no-unresolved": Array [ 2, Object { "commonjs": true, }, ], "import/order": Array [ 0, Object { "groups": Array [ "builtin", "external", "internal", "parent", "sibling", "index", ], "newlines-between": "never", }, ], "indent": Array [ "warn", 2, Object { "SwitchCase": 1, "VariableDeclarator": 1, }, ], "init-declarations": 0, "jsx-quotes": 0, "key-spacing": Array [ 2, Object { "afterColon": true, "beforeColon": false, }, ], "keyword-spacing": Array [ 2, Object { "after": true, "before": true, "overrides": Object { "case": Object { "after": true, }, "return": Object { "after": true, }, "throw": Object { "after": true, }, }, }, ], "linebreak-style": 0, "lines-around-comment": 0, "max-depth": Array [ 0, 4, ], "max-len": Array [ 2, 100, 2, Object { "ignoreComments": false, "ignoreUrls": true, }, ], "max-nested-callbacks": 0, "max-params": Array [ 0, 3, ], "max-statements": Array [ 0, 10, ], "max-statements-per-line": Array [ 0, Object { "max": 1, }, ], "new-cap": Array [ "off", Object { "newIsCap": true, }, ], "new-parens": 0, "newline-after-var": 0, "newline-before-return": 0, "newline-per-chained-call": Array [ 2, Object { "ignoreChainWithDepth": 3, }, ], "no-alert": 1, "no-array-constructor": 2, "no-bitwise": 0, "no-caller": 2, "no-case-declarations": 2, "no-catch-shadow": 0, "no-class-assign": 2, "no-cond-assign": Array [ 2, "always", ], "no-confusing-arrow": Array [ 2, Object { "allowParens": true, }, ], "no-console": "off", "no-const-assign": 2, "no-constant-condition": 1, "no-continue": 0, "no-control-regex": 2, "no-debugger": 2, "no-delete-var": 2, "no-div-regex": 0, "no-dupe-args": 2, "no-dupe-class-members": 2, "no-dupe-keys": 2, "no-duplicate-case": 2, "no-duplicate-imports": 2, "no-else-return": "off", "no-empty": 2, "no-empty-character-class": 2, "no-empty-function": Array [ 2, Object { "allow": Array [ "arrowFunctions", "functions", "methods", ], }, ], "no-empty-pattern": 2, "no-eq-null": 0, "no-eval": 2, "no-ex-assign": 2, "no-extend-native": 2, "no-extra-bind": 2, "no-extra-boolean-cast": 0, "no-extra-label": 2, "no-extra-parens": Array [ 0, "all", Object { "conditionalAssign": true, "nestedBinaryExpressions": false, }, ], "no-extra-semi": 2, "no-fallthrough": 2, "no-floating-decimal": 2, "no-func-assign": 2, "no-implicit-coercion": 0, "no-implicit-globals": 0, "no-implied-eval": 2, "no-inline-comments": 0, "no-inner-declarations": 2, "no-invalid-regexp": 2, "no-invalid-this": 0, "no-irregular-whitespace": 2, "no-iterator": 2, "no-label-var": 0, "no-labels": Array [ 2, Object { "allowLoop": false, "allowSwitch": false, }, ], "no-lone-blocks": 2, "no-lonely-if": 0, "no-loop-func": 2, "no-magic-numbers": Array [ 0, Object { "detectObjects": false, "enforceConst": true, "ignore": Array [], "ignoreArrayIndexes": true, }, ], "no-mixed-requires": Array [ 0, false, ], "no-mixed-spaces-and-tabs": 2, "no-multi-spaces": 2, "no-multi-str": 2, "no-multiple-empty-lines": Array [ 2, Object { "max": 2, "maxEOF": 1, }, ], "no-native-reassign": 2, "no-negated-condition": 0, "no-negated-in-lhs": 2, "no-nested-ternary": 2, "no-new": 2, "no-new-func": 2, "no-new-object": 2, "no-new-require": 0, "no-new-symbol": 2, "no-new-wrappers": 2, "no-obj-calls": 2, "no-octal": 2, "no-octal-escape": 2, "no-param-reassign": Array [ "error", Object { "props": false, }, ], "no-path-concat": 0, "no-plusplus": 0, "no-process-env": 0, "no-process-exit": 0, "no-proto": 2, "no-redeclare": 2, "no-regex-spaces": 2, "no-restricted-globals": 0, "no-restricted-imports": 0, "no-restricted-modules": 0, "no-restricted-syntax": Array [ 2, "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement", ], "no-return-assign": 2, "no-script-url": 2, "no-self-assign": 2, "no-self-compare": 2, "no-sequences": 2, "no-shadow": 2, "no-shadow-restricted-names": 2, "no-spaced-func": 2, "no-sparse-arrays": 2, "no-sync": 0, "no-ternary": 0, "no-this-before-super": 0, "no-throw-literal": 2, "no-trailing-spaces": 2, "no-undef": 2, "no-undef-init": 0, "no-undefined": 0, "no-underscore-dangle": Array [ 2, Object { "allowAfterThis": false, }, ], "no-unexpected-multiline": 0, "no-unmodified-loop-condition": 0, "no-unneeded-ternary": Array [ 2, Object { "defaultAssignment": false, }, ], "no-unreachable": 2, "no-unsafe-finally": 2, "no-unused-expressions": 2, "no-unused-labels": 2, "no-unused-vars": Array [ "warn", Object { "args": "after-used", "vars": "local", }, ], "no-use-before-define": 2, "no-useless-call": 0, "no-useless-computed-key": 2, "no-useless-concat": 2, "no-useless-constructor": 2, "no-useless-escape": 2, "no-void": 0, "no-warning-comments": Array [ 0, Object { "location": "start", "terms": Array [ "todo", "fixme", "xxx", ], }, ], "no-whitespace-before-property": 2, "object-curly-spacing": Array [ 2, "always", ], "object-shorthand": Array [ 2, "always", ], "one-var": Array [ 2, "never", ], "one-var-declaration-per-line": Array [ 2, "always", ], "operator-assignment": 0, "operator-linebreak": 0, "padded-blocks": Array [ 2, "never", ], "prefer-arrow-callback": Array [ 2, Object { "allowNamedFunctions": false, "allowUnboundThis": true, }, ], "prefer-reflect": 0, "prefer-rest-params": 2, "prefer-spread": 0, "prefer-template": 2, "quote-props": Array [ 2, "as-needed", Object { "keywords": false, "numbers": false, "unnecessary": true, }, ], "quotes": Array [ 2, "single", "avoid-escape", ], "radix": 2, "require-jsdoc": 0, "require-yield": 0, "semi": Array [ 2, "always", ], "semi-spacing": Array [ 2, Object { "after": true, "before": false, }, ], "sort-imports": 0, "sort-vars": 0, "space-before-blocks": 2, "space-before-function-paren": Array [ 2, Object { "anonymous": "always", "named": "never", }, ], "space-in-parens": Array [ 2, "never", ], "space-infix-ops": 2, "space-unary-ops": 0, "spaced-comment": Array [ 2, "always", Object { "exceptions": Array [ "-", "+", ], "markers": Array [ "=", "!", ], }, ], "strict": 2, "template-curly-spacing": 2, "use-isnan": 2, "valid-typeof": 2, "vars-on-top": 2, "wrap-iife": Array [ 2, "outside", ], "wrap-regex": 0, "yield-star-spacing": Array [ 2, "after", ], "yoda": 2, }, "settings": Object { "import/resolver": Object { "node": Object { "extensions": Array [ ".js", ".json", ], }, }, }, "useEslintrc": false, }, "eslintPath": "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint/lib/api.js", "filePath": "/Users/devgurus/Projects/bluestar_dashboard/src/modules/reports/client/controllers/reports.client.offers.controller.js", "logLevel": "trace", "prettierLast": false, "prettierOptions": Object { "bracketSpacing": true, "parser": "babylon", "printWidth": 100, "semi": true, "singleQuote": true, "tabWidth": 2, "trailingComma": "none", "useTabs": false, }, "prettierPath": "/Users/devgurus/.atom/packages/prettier-atom/node_modules/prettier/index.js", "text": "/* eslint-disable no-undef */ angular.module('reports').controller('ReportsOffersCtrl', [ '$scope', '$moment', 'Reports', '$log', 'toastr', ($scope, $moment, Reports, $log, toastr) => { function initCalendar() { $scope.startDate = $moment().startOf('month').toDate(); $scope.endDate = $moment().endOf('month').toDate(); $scope.rangeOptions = { ranges: { Today: [$moment(), $moment()], Yesterday: [$moment().subtract(1, 'days'), $moment().subtract(1, 'days')], 'Last 7 Days': [$moment().subtract(7, 'days'), $moment()], 'Last 30 Days': [$moment().subtract(29, 'days'), $moment()], 'This Month': [$moment().startOf('month'), $moment().endOf('month')], 'Last Month': [ $moment().subtract(1, 'month').startOf('month'), $moment().subtract(1, 'month').endOf('month'), ], }, opens: 'right', drops: 'down', startDate: $moment().startOf('month'), endDate: $moment().endOf('month'), parentEl: '#content', }; } function getLastSyncDate() { Reports.getLastSyncDate() .$promise.then(res => { $scope.lastSyncDate = res.lastSyncDate; }) .catch(err => { $log.error(`Error getting lastSyncDate , Error: ${JSON.stringify(err)}`); toastr.error('Opps! something went wrong'); }); } function getOfferQuantity(offer) { const mainProductQty = offer.mainProduct.totalQuantity || 0; const upsell1ProductQty = offer.upsell1.totalQuantity || 0; const upsell2ProductQty = offer.upsell2.totalQuantity || 0; const chiseledProductQty = offer.chiseled.totalQuantity || 0; return mainProductQty + upsell1ProductQty + upsell2ProductQty + chiseledProductQty; } function getOfferGrossSales(offer) { const mainProductGrossSales = offer.mainProduct.grossSales || 0; const upsell1ProductGrossSales = offer.upsell1.grossSales || 0; const upsell2ProductGrossSales = offer.upsell2.grossSales || 0; const chiseledProductGrossSales = offer.chiseled.grossSales || 0; return ( mainProductGrossSales + upsell1ProductGrossSales + upsell2ProductGrossSales + chiseledProductGrossSales ); } function getAvgSaleUnit(grossSales, quantity) { if (grossSales && quantity && quantity > 0) { return grossSales / quantity; } else { return 0; } } function getConversionOverViews(orders, views) { if (views && orders) { return (orders / views * 100).toFixed(2); } else { return 0; } } function getConversionOverOrders(orders1, orders2) { if (orders1 && orders2) { return (orders2 / orders1 * 100).toFixed(2); } else { return 0; } } function getOfferViews(offer) { return offer.mainProduct.views || 0; } function getOfferOrders(offer) { return offer.mainProduct.totalOrders || 0; } function getProductWithoutConversion(product) { return { ...product, option1: { ...product.option1, avgSaleUnit: getAvgSaleUnit(product.option1.grossSales, product.option1.totalQuantity), }, option2: { ...product.option2, avgSaleUnit: getAvgSaleUnit(product.option2.grossSales, product.option2.totalQuantity), }, option3: { ...product.option3, avgSaleUnit: getAvgSaleUnit(product.option3.grossSales, product.option3.totalQuantity), }, avgSaleUnit: getAvgSaleUnit(product.grossSales, product.totalQuantity), }; } function getMainProduct(product) { return { ...getProductWithoutConversion(product), conversion: getConversionOverViews(product.totalOrders, product.views), }; } function getUpsellProduct(product, offerOrders) { return { ...getProductWithoutConversion(product), conversion: getConversionOverOrders(offerOrders, product.totalOrders), }; } function getOffersReport(startDate, endDate) { Reports.offers({ startDate, endDate, }) .$promise.then(res => { $scope.offers = res.offersReport.map(offer => { const offerGrossSales = getOfferGrossSales(offer); const offerTotalQuantity = getOfferQuantity(offer); const offerViews = getOfferViews(offer); const offerOrders = getOfferOrders(offer); return { ...offer, mainProduct: getMainProduct(offer.mainProduct), chiseled: { ...offer.chiseled, conversion: getConversionOverOrders(offerOrders, offer.chiseled.totalOrders), avgSaleUnit: getAvgSaleUnit(offer.chiseled.grossSales, offer.chiseled.totalQuantity), }, upsell1: getUpsellProduct(offer.upsell1, offerOrders), upsell2: getUpsellProduct(offer.upsell2, offerOrders), views: offerViews, orders: offerOrders, conversion: getConversionOverViews(offerOrders, offerViews), grossSales: offerGrossSales, totalQuantity: offerTotalQuantity, avgSaleUnit: getAvgSaleUnit(offerGrossSales, offerTotalQuantity), }; }); }) .catch(err => { $log.error(`Error getting the report, Error: ${JSON.stringify(err)}`); $log.error(`Error getting the report, Error: ${err}`); toastr.error('Opps! something went wrong'); }); } $scope.refreshData = (startDate, endDate) => { getOffersReport(startDate, endDate); getLastSyncDate(); }; $scope.drillDown = row => { row.isDrilledDown = !row.isDrilledDown; }; $scope.syncWithCt = () => { Reports.syncWithCt() .$promise.then(() => { toastr.success('Sync has been scheduled. Please refresh the report after 30 seconds'); }) .catch(err => { if (err.status === 422) { toastr.error(err.data); } else { toastr.error('Opps! something went wrong'); $log.error(`Error syncing with CT , Error: ${JSON.stringify(err)}`); } }); }; function compare(field1, field2) { if (field1 > field2) { return 1; } if (field1 < field2) { return -1; } return 0; } $scope.sort = (offers, field, ascending) => { let offersSorted; if (ascending) { offersSorted = offers.sort((off1, off2) => compare(off1[field], off2[field])); } else { offersSorted = offers.sort((off1, off2) => compare(off2[field], off1[field])); } $scope.offers = offersSorted; $scope.sortBy.field = field; $scope.sortBy.ascending = ascending; }; function init() { initCalendar(); $scope.refreshData($scope.startDate, $scope.endDate); } init(); }, ]); ", } prettier-eslint [DEBUG]: calling prettier on text prettier-eslint [TRACE]: prettier input: /* eslint-disable no-undef */ angular.module('reports').controller('ReportsOffersCtrl', [ '$scope', '$moment', 'Reports', '$log', 'toastr', ($scope, $moment, Reports, $log, toastr) => { function initCalendar() { $scope.startDate = $moment().startOf('month').toDate(); $scope.endDate = $moment().endOf('month').toDate(); $scope.rangeOptions = { ranges: { Today: [$moment(), $moment()], Yesterday: [$moment().subtract(1, 'days'), $moment().subtract(1, 'days')], 'Last 7 Days': [$moment().subtract(7, 'days'), $moment()], 'Last 30 Days': [$moment().subtract(29, 'days'), $moment()], 'This Month': [$moment().startOf('month'), $moment().endOf('month')], 'Last Month': [ $moment().subtract(1, 'month').startOf('month'), $moment().subtract(1, 'month').endOf('month'), ], }, opens: 'right', drops: 'down', startDate: $moment().startOf('month'), endDate: $moment().endOf('month'), parentEl: '#content', }; } function getLastSyncDate() { Reports.getLastSyncDate() .$promise.then(res => { $scope.lastSyncDate = res.lastSyncDate; }) .catch(err => { $log.error(`Error getting lastSyncDate , Error: ${JSON.stringify(err)}`); toastr.error('Opps! something went wrong'); }); } function getOfferQuantity(offer) { const mainProductQty = offer.mainProduct.totalQuantity || 0; const upsell1ProductQty = offer.upsell1.totalQuantity || 0; const upsell2ProductQty = offer.upsell2.totalQuantity || 0; const chiseledProductQty = offer.chiseled.totalQuantity || 0; return mainProductQty + upsell1ProductQty + upsell2ProductQty + chiseledProductQty; } function getOfferGrossSales(offer) { const mainProductGrossSales = offer.mainProduct.grossSales || 0; const upsell1ProductGrossSales = offer.upsell1.grossSales || 0; const upsell2ProductGrossSales = offer.upsell2.grossSales || 0; const chiseledProductGrossSales = offer.chiseled.grossSales || 0; return ( mainProductGrossSales + upsell1ProductGrossSales + upsell2ProductGrossSales + chiseledProductGrossSales ); } function getAvgSaleUnit(grossSales, quantity) { if (grossSales && quantity && quantity > 0) { return grossSales / quantity; } else { return 0; } } function getConversionOverViews(orders, views) { if (views && orders) { return (orders / views * 100).toFixed(2); } else { return 0; } } function getConversionOverOrders(orders1, orders2) { if (orders1 && orders2) { return (orders2 / orders1 * 100).toFixed(2); } else { return 0; } } function getOfferViews(offer) { return offer.mainProduct.views || 0; } function getOfferOrders(offer) { return offer.mainProduct.totalOrders || 0; } function getProductWithoutConversion(product) { return { ...product, option1: { ...product.option1, avgSaleUnit: getAvgSaleUnit(product.option1.grossSales, product.option1.totalQuantity), }, option2: { ...product.option2, avgSaleUnit: getAvgSaleUnit(product.option2.grossSales, product.option2.totalQuantity), }, option3: { ...product.option3, avgSaleUnit: getAvgSaleUnit(product.option3.grossSales, product.option3.totalQuantity), }, avgSaleUnit: getAvgSaleUnit(product.grossSales, product.totalQuantity), }; } function getMainProduct(product) { return { ...getProductWithoutConversion(product), conversion: getConversionOverViews(product.totalOrders, product.views), }; } function getUpsellProduct(product, offerOrders) { return { ...getProductWithoutConversion(product), conversion: getConversionOverOrders(offerOrders, product.totalOrders), }; } function getOffersReport(startDate, endDate) { Reports.offers({ startDate, endDate, }) .$promise.then(res => { $scope.offers = res.offersReport.map(offer => { const offerGrossSales = getOfferGrossSales(offer); const offerTotalQuantity = getOfferQuantity(offer); const offerViews = getOfferViews(offer); const offerOrders = getOfferOrders(offer); return { ...offer, mainProduct: getMainProduct(offer.mainProduct), chiseled: { ...offer.chiseled, conversion: getConversionOverOrders(offerOrders, offer.chiseled.totalOrders), avgSaleUnit: getAvgSaleUnit(offer.chiseled.grossSales, offer.chiseled.totalQuantity), }, upsell1: getUpsellProduct(offer.upsell1, offerOrders), upsell2: getUpsellProduct(offer.upsell2, offerOrders), views: offerViews, orders: offerOrders, conversion: getConversionOverViews(offerOrders, offerViews), grossSales: offerGrossSales, totalQuantity: offerTotalQuantity, avgSaleUnit: getAvgSaleUnit(offerGrossSales, offerTotalQuantity), }; }); }) .catch(err => { $log.error(`Error getting the report, Error: ${JSON.stringify(err)}`); $log.error(`Error getting the report, Error: ${err}`); toastr.error('Opps! something went wrong'); }); } $scope.refreshData = (startDate, endDate) => { getOffersReport(startDate, endDate); getLastSyncDate(); }; $scope.drillDown = row => { row.isDrilledDown = !row.isDrilledDown; }; $scope.syncWithCt = () => { Reports.syncWithCt() .$promise.then(() => { toastr.success('Sync has been scheduled. Please refresh the report after 30 seconds'); }) .catch(err => { if (err.status === 422) { toastr.error(err.data); } else { toastr.error('Opps! something went wrong'); $log.error(`Error syncing with CT , Error: ${JSON.stringify(err)}`); } }); }; function compare(field1, field2) { if (field1 > field2) { return 1; } if (field1 < field2) { return -1; } return 0; } $scope.sort = (offers, field, ascending) => { let offersSorted; if (ascending) { offersSorted = offers.sort((off1, off2) => compare(off1[field], off2[field])); } else { offersSorted = offers.sort((off1, off2) => compare(off2[field], off1[field])); } $scope.offers = offersSorted; $scope.sortBy.field = field; $scope.sortBy.ascending = ascending; }; function init() { initCalendar(); $scope.refreshData($scope.startDate, $scope.endDate); } init(); }, ]); prettier-eslint [TRACE]: requiring prettier module at "/Users/devgurus/.atom/packages/prettier-atom/node_modules/prettier/index.js" prettier-eslint [TRACE]: calling prettier.format with the text and prettierOptions prettier-eslint [TRACE]: prettier: output === input false prettier-eslint [TRACE]: prettier output: /* eslint-disable no-undef */ angular.module('reports').controller('ReportsOffersCtrl', [ '$scope', '$moment', 'Reports', '$log', 'toastr', ($scope, $moment, Reports, $log, toastr) => { function initCalendar() { $scope.startDate = $moment().startOf('month').toDate(); $scope.endDate = $moment().endOf('month').toDate(); $scope.rangeOptions = { ranges: { Today: [$moment(), $moment()], Yesterday: [$moment().subtract(1, 'days'), $moment().subtract(1, 'days')], 'Last 7 Days': [$moment().subtract(7, 'days'), $moment()], 'Last 30 Days': [$moment().subtract(29, 'days'), $moment()], 'This Month': [$moment().startOf('month'), $moment().endOf('month')], 'Last Month': [ $moment().subtract(1, 'month').startOf('month'), $moment().subtract(1, 'month').endOf('month') ] }, opens: 'right', drops: 'down', startDate: $moment().startOf('month'), endDate: $moment().endOf('month'), parentEl: '#content' }; } function getLastSyncDate() { Reports.getLastSyncDate() .$promise.then(res => { $scope.lastSyncDate = res.lastSyncDate; }) .catch(err => { $log.error(`Error getting lastSyncDate , Error: ${JSON.stringify(err)}`); toastr.error('Opps! something went wrong'); }); } function getOfferQuantity(offer) { const mainProductQty = offer.mainProduct.totalQuantity || 0; const upsell1ProductQty = offer.upsell1.totalQuantity || 0; const upsell2ProductQty = offer.upsell2.totalQuantity || 0; const chiseledProductQty = offer.chiseled.totalQuantity || 0; return mainProductQty + upsell1ProductQty + upsell2ProductQty + chiseledProductQty; } function getOfferGrossSales(offer) { const mainProductGrossSales = offer.mainProduct.grossSales || 0; const upsell1ProductGrossSales = offer.upsell1.grossSales || 0; const upsell2ProductGrossSales = offer.upsell2.grossSales || 0; const chiseledProductGrossSales = offer.chiseled.grossSales || 0; return ( mainProductGrossSales + upsell1ProductGrossSales + upsell2ProductGrossSales + chiseledProductGrossSales ); } function getAvgSaleUnit(grossSales, quantity) { if (grossSales && quantity && quantity > 0) { return grossSales / quantity; } else { return 0; } } function getConversionOverViews(orders, views) { if (views && orders) { return (orders / views * 100).toFixed(2); } else { return 0; } } function getConversionOverOrders(orders1, orders2) { if (orders1 && orders2) { return (orders2 / orders1 * 100).toFixed(2); } else { return 0; } } function getOfferViews(offer) { return offer.mainProduct.views || 0; } function getOfferOrders(offer) { return offer.mainProduct.totalOrders || 0; } function getProductWithoutConversion(product) { return { ...product, option1: { ...product.option1, avgSaleUnit: getAvgSaleUnit(product.option1.grossSales, product.option1.totalQuantity) }, option2: { ...product.option2, avgSaleUnit: getAvgSaleUnit(product.option2.grossSales, product.option2.totalQuantity) }, option3: { ...product.option3, avgSaleUnit: getAvgSaleUnit(product.option3.grossSales, product.option3.totalQuantity) }, avgSaleUnit: getAvgSaleUnit(product.grossSales, product.totalQuantity) }; } function getMainProduct(product) { return { ...getProductWithoutConversion(product), conversion: getConversionOverViews(product.totalOrders, product.views) }; } function getUpsellProduct(product, offerOrders) { return { ...getProductWithoutConversion(product), conversion: getConversionOverOrders(offerOrders, product.totalOrders) }; } function getOffersReport(startDate, endDate) { Reports.offers({ startDate, endDate }) .$promise.then(res => { $scope.offers = res.offersReport.map(offer => { const offerGrossSales = getOfferGrossSales(offer); const offerTotalQuantity = getOfferQuantity(offer); const offerViews = getOfferViews(offer); const offerOrders = getOfferOrders(offer); return { ...offer, mainProduct: getMainProduct(offer.mainProduct), chiseled: { ...offer.chiseled, conversion: getConversionOverOrders(offerOrders, offer.chiseled.totalOrders), avgSaleUnit: getAvgSaleUnit(offer.chiseled.grossSales, offer.chiseled.totalQuantity) }, upsell1: getUpsellProduct(offer.upsell1, offerOrders), upsell2: getUpsellProduct(offer.upsell2, offerOrders), views: offerViews, orders: offerOrders, conversion: getConversionOverViews(offerOrders, offerViews), grossSales: offerGrossSales, totalQuantity: offerTotalQuantity, avgSaleUnit: getAvgSaleUnit(offerGrossSales, offerTotalQuantity) }; }); }) .catch(err => { $log.error(`Error getting the report, Error: ${JSON.stringify(err)}`); $log.error(`Error getting the report, Error: ${err}`); toastr.error('Opps! something went wrong'); }); } $scope.refreshData = (startDate, endDate) => { getOffersReport(startDate, endDate); getLastSyncDate(); }; $scope.drillDown = row => { row.isDrilledDown = !row.isDrilledDown; }; $scope.syncWithCt = () => { Reports.syncWithCt() .$promise.then(() => { toastr.success('Sync has been scheduled. Please refresh the report after 30 seconds'); }) .catch(err => { if (err.status === 422) { toastr.error(err.data); } else { toastr.error('Opps! something went wrong'); $log.error(`Error syncing with CT , Error: ${JSON.stringify(err)}`); } }); }; function compare(field1, field2) { if (field1 > field2) { return 1; } if (field1 < field2) { return -1; } return 0; } $scope.sort = (offers, field, ascending) => { let offersSorted; if (ascending) { offersSorted = offers.sort((off1, off2) => compare(off1[field], off2[field])); } else { offersSorted = offers.sort((off1, off2) => compare(off2[field], off1[field])); } $scope.offers = offersSorted; $scope.sortBy.field = field; $scope.sortBy.ascending = ascending; }; function init() { initCalendar(); $scope.refreshData($scope.startDate, $scope.endDate); } init(); } ]); prettier-eslint [TRACE]: requiring eslint module at "/Users/devgurus/Projects/bluestar_dashboard/node_modules/eslint/lib/api.js" prettier-eslint [TRACE]: calling eslint.executeOnText with the text prettier-eslint [TRACE]: executeOnText returned the following report: Object { "errorCount": 1, "results": Array [ Object { "errorCount": 1, "filePath": "", "messages": Array [ Object { "column": 1, "line": 148, "message": "Line 148 exceeds the maximum line length of 100.", "nodeType": "Program", "ruleId": "max-len", "severity": 2, "source": " avgSaleUnit: getAvgSaleUnit(offer.chiseled.grossSales, offer.chiseled.totalQuantity),", }, ], "output": "/* eslint-disable no-undef */ angular.module('reports').controller('ReportsOffersCtrl', [ '$scope', '$moment', 'Reports', '$log', 'toastr', ($scope, $moment, Reports, $log, toastr) => { function initCalendar() { $scope.startDate = $moment().startOf('month').toDate(); $scope.endDate = $moment().endOf('month').toDate(); $scope.rangeOptions = { ranges: { Today: [$moment(), $moment()], Yesterday: [$moment().subtract(1, 'days'), $moment().subtract(1, 'days')], 'Last 7 Days': [$moment().subtract(7, 'days'), $moment()], 'Last 30 Days': [$moment().subtract(29, 'days'), $moment()], 'This Month': [$moment().startOf('month'), $moment().endOf('month')], 'Last Month': [ $moment().subtract(1, 'month').startOf('month'), $moment().subtract(1, 'month').endOf('month'), ], }, opens: 'right', drops: 'down', startDate: $moment().startOf('month'), endDate: $moment().endOf('month'), parentEl: '#content', }; } function getLastSyncDate() { Reports.getLastSyncDate() .$promise.then(res => { $scope.lastSyncDate = res.lastSyncDate; }) .catch(err => { $log.error(`Error getting lastSyncDate , Error: ${JSON.stringify(err)}`); toastr.error('Opps! something went wrong'); }); } function getOfferQuantity(offer) { const mainProductQty = offer.mainProduct.totalQuantity || 0; const upsell1ProductQty = offer.upsell1.totalQuantity || 0; const upsell2ProductQty = offer.upsell2.totalQuantity || 0; const chiseledProductQty = offer.chiseled.totalQuantity || 0; return mainProductQty + upsell1ProductQty + upsell2ProductQty + chiseledProductQty; } function getOfferGrossSales(offer) { const mainProductGrossSales = offer.mainProduct.grossSales || 0; const upsell1ProductGrossSales = offer.upsell1.grossSales || 0; const upsell2ProductGrossSales = offer.upsell2.grossSales || 0; const chiseledProductGrossSales = offer.chiseled.grossSales || 0; return ( mainProductGrossSales + upsell1ProductGrossSales + upsell2ProductGrossSales + chiseledProductGrossSales ); } function getAvgSaleUnit(grossSales, quantity) { if (grossSales && quantity && quantity > 0) { return grossSales / quantity; } else { return 0; } } function getConversionOverViews(orders, views) { if (views && orders) { return (orders / views * 100).toFixed(2); } else { return 0; } } function getConversionOverOrders(orders1, orders2) { if (orders1 && orders2) { return (orders2 / orders1 * 100).toFixed(2); } else { return 0; } } function getOfferViews(offer) { return offer.mainProduct.views || 0; } function getOfferOrders(offer) { return offer.mainProduct.totalOrders || 0; } function getProductWithoutConversion(product) { return { ...product, option1: { ...product.option1, avgSaleUnit: getAvgSaleUnit(product.option1.grossSales, product.option1.totalQuantity), }, option2: { ...product.option2, avgSaleUnit: getAvgSaleUnit(product.option2.grossSales, product.option2.totalQuantity), }, option3: { ...product.option3, avgSaleUnit: getAvgSaleUnit(product.option3.grossSales, product.option3.totalQuantity), }, avgSaleUnit: getAvgSaleUnit(product.grossSales, product.totalQuantity), }; } function getMainProduct(product) { return { ...getProductWithoutConversion(product), conversion: getConversionOverViews(product.totalOrders, product.views), }; } function getUpsellProduct(product, offerOrders) { return { ...getProductWithoutConversion(product), conversion: getConversionOverOrders(offerOrders, product.totalOrders), }; } function getOffersReport(startDate, endDate) { Reports.offers({ startDate, endDate, }) .$promise.then(res => { $scope.offers = res.offersReport.map(offer => { const offerGrossSales = getOfferGrossSales(offer); const offerTotalQuantity = getOfferQuantity(offer); const offerViews = getOfferViews(offer); const offerOrders = getOfferOrders(offer); return { ...offer, mainProduct: getMainProduct(offer.mainProduct), chiseled: { ...offer.chiseled, conversion: getConversionOverOrders(offerOrders, offer.chiseled.totalOrders), avgSaleUnit: getAvgSaleUnit(offer.chiseled.grossSales, offer.chiseled.totalQuantity), }, upsell1: getUpsellProduct(offer.upsell1, offerOrders), upsell2: getUpsellProduct(offer.upsell2, offerOrders), views: offerViews, orders: offerOrders, conversion: getConversionOverViews(offerOrders, offerViews), grossSales: offerGrossSales, totalQuantity: offerTotalQuantity, avgSaleUnit: getAvgSaleUnit(offerGrossSales, offerTotalQuantity), }; }); }) .catch(err => { $log.error(`Error getting the report, Error: ${JSON.stringify(err)}`); $log.error(`Error getting the report, Error: ${err}`); toastr.error('Opps! something went wrong'); }); } $scope.refreshData = (startDate, endDate) => { getOffersReport(startDate, endDate); getLastSyncDate(); }; $scope.drillDown = row => { row.isDrilledDown = !row.isDrilledDown; }; $scope.syncWithCt = () => { Reports.syncWithCt() .$promise.then(() => { toastr.success('Sync has been scheduled. Please refresh the report after 30 seconds'); }) .catch(err => { if (err.status === 422) { toastr.error(err.data); } else { toastr.error('Opps! something went wrong'); $log.error(`Error syncing with CT , Error: ${JSON.stringify(err)}`); } }); }; function compare(field1, field2) { if (field1 > field2) { return 1; } if (field1 < field2) { return -1; } return 0; } $scope.sort = (offers, field, ascending) => { let offersSorted; if (ascending) { offersSorted = offers.sort((off1, off2) => compare(off1[field], off2[field])); } else { offersSorted = offers.sort((off1, off2) => compare(off2[field], off1[field])); } $scope.offers = offersSorted; $scope.sortBy.field = field; $scope.sortBy.ascending = ascending; }; function init() { initCalendar(); $scope.refreshData($scope.startDate, $scope.endDate); } init(); }, ]); ", "warningCount": 0, }, ], "warningCount": 0, } prettier-eslint [TRACE]: eslint --fix: output === input false prettier-eslint [TRACE]: eslint --fix output: /* eslint-disable no-undef */ angular.module('reports').controller('ReportsOffersCtrl', [ '$scope', '$moment', 'Reports', '$log', 'toastr', ($scope, $moment, Reports, $log, toastr) => { function initCalendar() { $scope.startDate = $moment().startOf('month').toDate(); $scope.endDate = $moment().endOf('month').toDate(); $scope.rangeOptions = { ranges: { Today: [$moment(), $moment()], Yesterday: [$moment().subtract(1, 'days'), $moment().subtract(1, 'days')], 'Last 7 Days': [$moment().subtract(7, 'days'), $moment()], 'Last 30 Days': [$moment().subtract(29, 'days'), $moment()], 'This Month': [$moment().startOf('month'), $moment().endOf('month')], 'Last Month': [ $moment().subtract(1, 'month').startOf('month'), $moment().subtract(1, 'month').endOf('month'), ], }, opens: 'right', drops: 'down', startDate: $moment().startOf('month'), endDate: $moment().endOf('month'), parentEl: '#content', }; } function getLastSyncDate() { Reports.getLastSyncDate() .$promise.then(res => { $scope.lastSyncDate = res.lastSyncDate; }) .catch(err => { $log.error(`Error getting lastSyncDate , Error: ${JSON.stringify(err)}`); toastr.error('Opps! something went wrong'); }); } function getOfferQuantity(offer) { const mainProductQty = offer.mainProduct.totalQuantity || 0; const upsell1ProductQty = offer.upsell1.totalQuantity || 0; const upsell2ProductQty = offer.upsell2.totalQuantity || 0; const chiseledProductQty = offer.chiseled.totalQuantity || 0; return mainProductQty + upsell1ProductQty + upsell2ProductQty + chiseledProductQty; } function getOfferGrossSales(offer) { const mainProductGrossSales = offer.mainProduct.grossSales || 0; const upsell1ProductGrossSales = offer.upsell1.grossSales || 0; const upsell2ProductGrossSales = offer.upsell2.grossSales || 0; const chiseledProductGrossSales = offer.chiseled.grossSales || 0; return ( mainProductGrossSales + upsell1ProductGrossSales + upsell2ProductGrossSales + chiseledProductGrossSales ); } function getAvgSaleUnit(grossSales, quantity) { if (grossSales && quantity && quantity > 0) { return grossSales / quantity; } else { return 0; } } function getConversionOverViews(orders, views) { if (views && orders) { return (orders / views * 100).toFixed(2); } else { return 0; } } function getConversionOverOrders(orders1, orders2) { if (orders1 && orders2) { return (orders2 / orders1 * 100).toFixed(2); } else { return 0; } } function getOfferViews(offer) { return offer.mainProduct.views || 0; } function getOfferOrders(offer) { return offer.mainProduct.totalOrders || 0; } function getProductWithoutConversion(product) { return { ...product, option1: { ...product.option1, avgSaleUnit: getAvgSaleUnit(product.option1.grossSales, product.option1.totalQuantity), }, option2: { ...product.option2, avgSaleUnit: getAvgSaleUnit(product.option2.grossSales, product.option2.totalQuantity), }, option3: { ...product.option3, avgSaleUnit: getAvgSaleUnit(product.option3.grossSales, product.option3.totalQuantity), }, avgSaleUnit: getAvgSaleUnit(product.grossSales, product.totalQuantity), }; } function getMainProduct(product) { return { ...getProductWithoutConversion(product), conversion: getConversionOverViews(product.totalOrders, product.views), }; } function getUpsellProduct(product, offerOrders) { return { ...getProductWithoutConversion(product), conversion: getConversionOverOrders(offerOrders, product.totalOrders), }; } function getOffersReport(startDate, endDate) { Reports.offers({ startDate, endDate, }) .$promise.then(res => { $scope.offers = res.offersReport.map(offer => { const offerGrossSales = getOfferGrossSales(offer); const offerTotalQuantity = getOfferQuantity(offer); const offerViews = getOfferViews(offer); const offerOrders = getOfferOrders(offer); return { ...offer, mainProduct: getMainProduct(offer.mainProduct), chiseled: { ...offer.chiseled, conversion: getConversionOverOrders(offerOrders, offer.chiseled.totalOrders), avgSaleUnit: getAvgSaleUnit(offer.chiseled.grossSales, offer.chiseled.totalQuantity), }, upsell1: getUpsellProduct(offer.upsell1, offerOrders), upsell2: getUpsellProduct(offer.upsell2, offerOrders), views: offerViews, orders: offerOrders, conversion: getConversionOverViews(offerOrders, offerViews), grossSales: offerGrossSales, totalQuantity: offerTotalQuantity, avgSaleUnit: getAvgSaleUnit(offerGrossSales, offerTotalQuantity), }; }); }) .catch(err => { $log.error(`Error getting the report, Error: ${JSON.stringify(err)}`); $log.error(`Error getting the report, Error: ${err}`); toastr.error('Opps! something went wrong'); }); } $scope.refreshData = (startDate, endDate) => { getOffersReport(startDate, endDate); getLastSyncDate(); }; $scope.drillDown = row => { row.isDrilledDown = !row.isDrilledDown; }; $scope.syncWithCt = () => { Reports.syncWithCt() .$promise.then(() => { toastr.success('Sync has been scheduled. Please refresh the report after 30 seconds'); }) .catch(err => { if (err.status === 422) { toastr.error(err.data); } else { toastr.error('Opps! something went wrong'); $log.error(`Error syncing with CT , Error: ${JSON.stringify(err)}`); } }); }; function compare(field1, field2) { if (field1 > field2) { return 1; } if (field1 < field2) { return -1; } return 0; } $scope.sort = (offers, field, ascending) => { let offersSorted; if (ascending) { offersSorted = offers.sort((off1, off2) => compare(off1[field], off2[field])); } else { offersSorted = offers.sort((off1, off2) => compare(off2[field], off1[field])); } $scope.offers = offersSorted; $scope.sortBy.field = field; $scope.sortBy.ascending = ascending; }; function init() { initCalendar(); $scope.refreshData($scope.startDate, $scope.endDate); } init(); }, ]);