From f19c1a52992822a73a57c48ffb1b2dba031933cb Mon Sep 17 00:00:00 2001 From: Giuseppe Attardi <giuseppe.attardi@garr.it> Date: Sun, 7 Jul 2019 19:05:02 +0200 Subject: [PATCH] Update views.py --- charms/garr-dashboard/files/plugins/project-costs/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charms/garr-dashboard/files/plugins/project-costs/views.py b/charms/garr-dashboard/files/plugins/project-costs/views.py index f9079eb..71812fe 100644 --- a/charms/garr-dashboard/files/plugins/project-costs/views.py +++ b/charms/garr-dashboard/files/plugins/project-costs/views.py @@ -157,8 +157,8 @@ class IndexView(tables.DataTableView): def get_price(self, resource, request, db_session): if resource['type'] == 'instance': - flavor_name = resource.get('flavor_name', None) - if not flavor_name: flavor_name = api.nova.flavor_get(request, resource['flavor_id']).name + flavor_name = resource.get('flavor_name', + api.nova.flavor_get(request, resource['flavor_id']).name) flavor = db_session.query(Flavor).filter(Flavor.name == flavor_name).first() row_list = db_session.query(Price).filter(Price.resource == flavor.id, Price.type == 'flavor').all() elif resource['type'] == 'volume': -- GitLab