You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following date field:
date_recorded = models.DateField(_('Date Recorded'), default=datetime.date.today)
When the model is saved and a report generated any row created 'today' is included in the Pie Chart and the Table but has 0 entries. A hunch suggested setting the 'To Date' filter to the next day. The Pie Chart then went from 0% to 8% with my data and the table row went from 0 to 1.
My guess is a Less Than/ Greater Than should be <= or >= to be inclusive of todays date.
With code like this:
class TypeComputationField(ComputationField):
calculation_method = Count
calculation_field = "type"
verbose_name = _("Category")
name = "type_count"
class SafetyObservationTypeReport(ReportView):
report_model = SafetyObservation
report_title = _("Safety Observation Category Report")
date_field = 'date_recorded'
#limit_records = 10 # Top 10
group_by = "type" # group by choicefield type
columns = [ 'type', (TypeComputationField, {"verbose_name": _("Observations per Category")}) ]
chart_settings = [
Chart(
_("Top 10 Safety Observation Categories"),
Chart.PIE,
data_source=["type_count"],
title_source=["type"]
),
]
The text was updated successfully, but these errors were encountered:
I have the following date field:
date_recorded = models.DateField(_('Date Recorded'), default=datetime.date.today)
When the model is saved and a report generated any row created 'today' is included in the Pie Chart and the Table but has 0 entries. A hunch suggested setting the 'To Date' filter to the next day. The Pie Chart then went from 0% to 8% with my data and the table row went from 0 to 1.
My guess is a Less Than/ Greater Than should be <= or >= to be inclusive of todays date.
With code like this:
class TypeComputationField(ComputationField):
calculation_method = Count
calculation_field = "type"
verbose_name = _("Category")
name = "type_count"
class SafetyObservationTypeReport(ReportView):
report_model = SafetyObservation
report_title = _("Safety Observation Category Report")
date_field = 'date_recorded'
#limit_records = 10 # Top 10
group_by = "type" # group by choicefield type
columns = [ 'type', (TypeComputationField, {"verbose_name": _("Observations per Category")}) ]
chart_settings = [
Chart(
_("Top 10 Safety Observation Categories"),
Chart.PIE,
data_source=["type_count"],
title_source=["type"]
),
]
The text was updated successfully, but these errors were encountered: