Added statistics API
This commit is contained in:
parent
2770f0e8d8
commit
d435d5db04
1 changed files with 31 additions and 13 deletions
|
@ -37,6 +37,27 @@ export const jugglService = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getStatistics(options = {}) {
|
||||||
|
if (options.from === undefined) {
|
||||||
|
options.from = new Date();
|
||||||
|
}
|
||||||
|
if (options.until === undefined) {
|
||||||
|
options.until = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
return apiService
|
||||||
|
.post("/getStats.php", {
|
||||||
|
from_date: helperService.toISODateOnly(options.from),
|
||||||
|
until_date: helperService.toISODateOnly(options.until)
|
||||||
|
})
|
||||||
|
.then(r => {
|
||||||
|
return {
|
||||||
|
data: { statistics: processVisibility(r.data.stats) },
|
||||||
|
msg: ""
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getRecord(recordId) {
|
getRecord(recordId) {
|
||||||
return apiService
|
return apiService
|
||||||
.post("/getRecord.php", {
|
.post("/getRecord.php", {
|
||||||
|
@ -257,23 +278,20 @@ function processRecords(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function processTags(tags) {
|
function processTags(tags) {
|
||||||
Object.values(tags).forEach(tag => {
|
return processVisibility(tags);
|
||||||
if (tag.visible === "1") {
|
|
||||||
tag.visible = true;
|
|
||||||
} else {
|
|
||||||
tag.visible = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return tags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function processProjects(projects) {
|
function processProjects(projects) {
|
||||||
Object.values(projects).forEach(pro => {
|
return processVisibility(projects);
|
||||||
if (pro.visible === "1") {
|
}
|
||||||
pro.visible = true;
|
|
||||||
|
function processVisibility(items) {
|
||||||
|
Object.values(items).forEach(item => {
|
||||||
|
if (item.visible === "1") {
|
||||||
|
item.visible = true;
|
||||||
} else {
|
} else {
|
||||||
pro.visible = false;
|
item.visible = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return projects;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue