refactor(analytics report): linting
This commit is contained in:
parent
61b92b312a
commit
46d5f4c7f1
@ -87,12 +87,18 @@ frappe.query_reports["Purchase Analytics"] = {
|
||||
row_name = data[2].content;
|
||||
length = data.length;
|
||||
|
||||
if (tree_type == "Supplier" || tree_type == "Item") {
|
||||
if (tree_type == "Supplier") {
|
||||
row_values = data
|
||||
.slice(4, length - 1)
|
||||
.map(function (column) {
|
||||
return column.content;
|
||||
});
|
||||
} else if (tree_type == "Item") {
|
||||
row_values = data
|
||||
.slice(5, length - 1)
|
||||
.map(function (column) {
|
||||
return column.content;
|
||||
});
|
||||
} else {
|
||||
row_values = data
|
||||
.slice(3, length - 1)
|
||||
@ -109,17 +115,15 @@ frappe.query_reports["Purchase Analytics"] = {
|
||||
let raw_data = frappe.query_report.chart.data;
|
||||
let new_datasets = raw_data.datasets;
|
||||
|
||||
let found = false;
|
||||
|
||||
for (let i = 0; i < new_datasets.length; i++) {
|
||||
if (new_datasets[i].name == row_name) {
|
||||
found = true;
|
||||
new_datasets.splice(i, 1);
|
||||
break;
|
||||
let element_found = new_datasets.some((element, index, array)=>{
|
||||
if(element.name == row_name){
|
||||
array.splice(index, 1)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
if (!found) {
|
||||
if (!element_found) {
|
||||
new_datasets.push(entry);
|
||||
}
|
||||
let new_data = {
|
||||
|
@ -76,7 +76,6 @@ frappe.query_reports["Sales Analytics"] = {
|
||||
events: {
|
||||
onCheckRow: function (data) {
|
||||
if (!data) return;
|
||||
|
||||
const data_doctype = $(
|
||||
data[2].html
|
||||
)[0].attributes.getNamedItem("data-doctype").value;
|
||||
@ -114,17 +113,15 @@ frappe.query_reports["Sales Analytics"] = {
|
||||
let raw_data = frappe.query_report.chart.data;
|
||||
let new_datasets = raw_data.datasets;
|
||||
|
||||
let found = false;
|
||||
|
||||
for (let i = 0; i < new_datasets.length; i++) {
|
||||
if (new_datasets[i].name == row_name) {
|
||||
found = true;
|
||||
new_datasets.splice(i, 1);
|
||||
break;
|
||||
let element_found = new_datasets.some((element, index, array)=>{
|
||||
if(element.name == row_name){
|
||||
array.splice(index, 1)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
if (!found) {
|
||||
if (!element_found) {
|
||||
new_datasets.push(entry);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user