def get_all_values(self, obj): gasoline_rows = CreditCalculationService.get_all( model_name="CarbonIntensityLimit", fuel_class__fuel_class="Gasoline", compliance_period_id=obj.id, ) diesel_rows = CreditCalculationService.get_all( model_name="CarbonIntensityLimit", fuel_class__fuel_class="Diesel", compliance_period_id=obj.id, ) rows = list(gasoline_rows) + list(diesel_rows) serialized = [] for row in rows: serialized.append({ "fuel_class": row.fuel_class.fuel_class, "density": row.density, "effective_date": row.effective_date, "expiration_date": row.effective_date, "create_timestamp": row.create_timestamp }) return serialized
def get_all_values(self, obj): gasoline_rows = CreditCalculationService.get_all( model_name="EnergyEffectivenessRatio", fuel_class__fuel_class="Gasoline", category_id=obj.id ) diesel_rows = CreditCalculationService.get_all( model_name="EnergyEffectivenessRatio", fuel_class__fuel_class="Diesel", category_id=obj.id ) rows = list(gasoline_rows) + list(diesel_rows) serialized = [] for row in rows: serialized.append({ "ratio": row.ratio, "fuel_class": row.fuel_class.fuel_class, "effective_date": row.effective_date, "expiration_date": row.expiration_date, "create_timestamp": row.create_timestamp }) return serialized
def get_all_values(self, obj): rows = CreditCalculationService.get_all(model_name="EnergyDensity", category_id=obj.id) serialized = [] for row in rows: serialized.append({ "density": row.density, "effective_date": row.effective_date, "expiration_date": row.expiration_date, "create_timestamp": row.create_timestamp }) return serialized