Merge pull request #261 from eReuse/feature/#3325-new-features-filter

fixed bug
This commit is contained in:
cayop 2022-05-09 17:09:28 +02:00 committed by GitHub
commit bb21ca6513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -142,9 +142,7 @@ class FilterForm(FlaskForm):
if self.device_type: if self.device_type:
self.filter.data = self.device_type self.filter.data = self.device_type
def search(self): def filter_from_lots(self):
# Filter from lots
if self.lot_id: if self.lot_id:
self.lot = self.lots.filter(Lot.id == self.lot_id).one() self.lot = self.lots.filter(Lot.id == self.lot_id).one()
device_ids = (d.id for d in self.lot.devices) device_ids = (d.id for d in self.lot.devices)
@ -154,6 +152,8 @@ class FilterForm(FlaskForm):
lots=None lots=None
) )
def search(self):
self.filter_from_lots()
filter_type = None filter_type = None
if self.device_type: if self.device_type:
filter_type = [self.device_type] filter_type = [self.device_type]
@ -165,9 +165,12 @@ class FilterForm(FlaskForm):
if "All Devices" == self.device_type: if "All Devices" == self.device_type:
filter_type = None filter_type = None
if "All Components" == self.device_type: elif "All Components" == self.device_type:
filter_type = COMPONENTS filter_type = COMPONENTS
elif "All Computers" == self.device_type:
filter_type = COMPUTERS
elif "All Monitors" == self.device_type: elif "All Monitors" == self.device_type:
filter_type = MONITORS filter_type = MONITORS