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;
|
||||
})
|
||||
|
||||
|
||||
entry = {
|
||||
'name': row_name,
|
||||
'values': row_values
|
||||
@ -95,8 +94,7 @@ frappe.query_reports['Patient Appointment Analytics'] = {
|
||||
let new_datasets = raw_data.datasets;
|
||||
|
||||
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) {
|
||||
found = true;
|
||||
new_datasets.splice(i,1);
|
||||
|
@ -84,14 +84,14 @@ class Analytics(object):
|
||||
self.columns.append({
|
||||
'label': _(period),
|
||||
'fieldname': scrub(period),
|
||||
'fieldtype': 'Float',
|
||||
'fieldtype': 'Int',
|
||||
'width': 120
|
||||
})
|
||||
|
||||
self.columns.append({
|
||||
'label': _('Total'),
|
||||
'fieldname': 'total',
|
||||
'fieldtype': 'Float',
|
||||
'fieldtype': 'Int',
|
||||
'width': 120
|
||||
})
|
||||
|
||||
@ -106,15 +106,18 @@ class Analytics(object):
|
||||
|
||||
def get_period(self, appointment_date):
|
||||
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':
|
||||
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':
|
||||
period = 'Quarter ' + str(((appointment_date.month - 1) // 3) + 1) + ' ' + str(appointment_date.year)
|
||||
period = 'Quarter ' + str(((appointment_date.month - 1) // 3) + 1)
|
||||
else:
|
||||
year = get_fiscal_year(appointment_date, company=self.filters.company)
|
||||
period = str(year[0])
|
||||
|
||||
if getdate(self.filters.from_date).year != getdate(self.filters.to_date).year:
|
||||
period += ' ' + str(appointment_date.year)
|
||||
|
||||
return period
|
||||
|
||||
def get_appointments_based_on_healthcare_practitioner(self):
|
||||
@ -180,7 +183,7 @@ class Analytics(object):
|
||||
|
||||
def get_chart_data(self):
|
||||
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 = {
|
||||
"data": {
|
||||
'labels': labels,
|
||||
|
Loading…
Reference in New Issue
Block a user