fix: don't append year if values have same year in Appointment Analytics
This commit is contained in:
parent
2cec6bd789
commit
42376705ab
@ -85,7 +85,6 @@ frappe.query_reports['Patient Appointment Analytics'] = {
|
|||||||
return column.content;
|
return column.content;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
entry = {
|
entry = {
|
||||||
'name': row_name,
|
'name': row_name,
|
||||||
'values': row_values
|
'values': row_values
|
||||||
@ -95,7 +94,6 @@ frappe.query_reports['Patient Appointment Analytics'] = {
|
|||||||
let new_datasets = raw_data.datasets;
|
let new_datasets = raw_data.datasets;
|
||||||
|
|
||||||
let found = false;
|
let found = false;
|
||||||
|
|
||||||
for (let i=0; i < new_datasets.length;i++) {
|
for (let i=0; i < new_datasets.length;i++) {
|
||||||
if (new_datasets[i].name == row_name) {
|
if (new_datasets[i].name == row_name) {
|
||||||
found = true;
|
found = true;
|
||||||
|
|||||||
@ -84,14 +84,14 @@ class Analytics(object):
|
|||||||
self.columns.append({
|
self.columns.append({
|
||||||
'label': _(period),
|
'label': _(period),
|
||||||
'fieldname': scrub(period),
|
'fieldname': scrub(period),
|
||||||
'fieldtype': 'Float',
|
'fieldtype': 'Int',
|
||||||
'width': 120
|
'width': 120
|
||||||
})
|
})
|
||||||
|
|
||||||
self.columns.append({
|
self.columns.append({
|
||||||
'label': _('Total'),
|
'label': _('Total'),
|
||||||
'fieldname': 'total',
|
'fieldname': 'total',
|
||||||
'fieldtype': 'Float',
|
'fieldtype': 'Int',
|
||||||
'width': 120
|
'width': 120
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -106,15 +106,18 @@ class Analytics(object):
|
|||||||
|
|
||||||
def get_period(self, appointment_date):
|
def get_period(self, appointment_date):
|
||||||
if self.filters.range == 'Weekly':
|
if self.filters.range == 'Weekly':
|
||||||
period = 'Week ' + str(appointment_date.isocalendar()[1]) + ' ' + str(appointment_date.year)
|
period = 'Week ' + str(appointment_date.isocalendar()[1])
|
||||||
elif self.filters.range == 'Monthly':
|
elif self.filters.range == 'Monthly':
|
||||||
period = str(self.months[appointment_date.month - 1]) + ' ' + str(appointment_date.year)
|
period = str(self.months[appointment_date.month - 1])
|
||||||
elif self.filters.range == 'Quarterly':
|
elif self.filters.range == 'Quarterly':
|
||||||
period = 'Quarter ' + str(((appointment_date.month - 1) // 3) + 1) + ' ' + str(appointment_date.year)
|
period = 'Quarter ' + str(((appointment_date.month - 1) // 3) + 1)
|
||||||
else:
|
else:
|
||||||
year = get_fiscal_year(appointment_date, company=self.filters.company)
|
year = get_fiscal_year(appointment_date, company=self.filters.company)
|
||||||
period = str(year[0])
|
period = str(year[0])
|
||||||
|
|
||||||
|
if getdate(self.filters.from_date).year != getdate(self.filters.to_date).year:
|
||||||
|
period += ' ' + str(appointment_date.year)
|
||||||
|
|
||||||
return period
|
return period
|
||||||
|
|
||||||
def get_appointments_based_on_healthcare_practitioner(self):
|
def get_appointments_based_on_healthcare_practitioner(self):
|
||||||
@ -180,7 +183,7 @@ class Analytics(object):
|
|||||||
|
|
||||||
def get_chart_data(self):
|
def get_chart_data(self):
|
||||||
length = len(self.columns)
|
length = len(self.columns)
|
||||||
labels = [d.get("label") for d in self.columns[3:length - 1]]
|
labels = [d.get("label") for d in self.columns[1:length - 1]]
|
||||||
self.chart = {
|
self.chart = {
|
||||||
"data": {
|
"data": {
|
||||||
'labels': labels,
|
'labels': labels,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user