parent
642392bbf3
commit
7adff92c9c
@ -477,7 +477,7 @@ class EditRule(ManagedWindow.ManagedWindow):
|
|||||||
t = MyInteger(0, 999)
|
t = MyInteger(0, 999)
|
||||||
elif v == _('Reference count must be:'):
|
elif v == _('Reference count must be:'):
|
||||||
t = MyLesserEqualGreater()
|
t = MyLesserEqualGreater()
|
||||||
elif v == _('Number must be'):
|
elif v == _('Number must be:'):
|
||||||
t = MyLesserEqualGreater(1)
|
t = MyLesserEqualGreater(1)
|
||||||
elif v == _('Number of generations:'):
|
elif v == _('Number of generations:'):
|
||||||
t = MyInteger(1, 32)
|
t = MyInteger(1, 32)
|
||||||
|
@ -43,5 +43,5 @@ from Filters.Rules._HasLDSBase import HasLDSBase
|
|||||||
class HasLDS(HasLDSBase):
|
class HasLDS(HasLDSBase):
|
||||||
"""Rule that checks for family with a LDS event"""
|
"""Rule that checks for family with a LDS event"""
|
||||||
|
|
||||||
name = _('Families with LDS event')
|
name = _('Families with LDS events')
|
||||||
description = _("Matches families with LDS event")
|
description = _("Matches families with a certain number of LDS events")
|
||||||
|
@ -43,5 +43,5 @@ from Filters.Rules._HasLDSBase import HasLDSBase
|
|||||||
class HasLDS(HasLDSBase):
|
class HasLDS(HasLDSBase):
|
||||||
"""Rule that checks for a person with a LDS event"""
|
"""Rule that checks for a person with a LDS event"""
|
||||||
|
|
||||||
name = _('People with LDS event')
|
name = _('People with LDS events')
|
||||||
description = _("Matches people with LDS event")
|
description = _("Matches people with a certain number of LDS events")
|
||||||
|
@ -40,8 +40,8 @@ from Filters.Rules import Rule
|
|||||||
class HasGalleryBase(Rule):
|
class HasGalleryBase(Rule):
|
||||||
"""Objects who have Media Object"""
|
"""Objects who have Media Object"""
|
||||||
|
|
||||||
labels = [ _('Number of instances:'), _('Number must be')]
|
labels = [ _('Number of instances:'), _('Number must be:')]
|
||||||
name = _('Object with <count> Media reference')
|
name = _('Object with <count> Media references')
|
||||||
description = _("Matches objects with certain number of items in the gallery")
|
description = _("Matches objects with certain number of items in the gallery")
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
|
||||||
|
@ -43,9 +43,27 @@ from Filters.Rules import Rule
|
|||||||
class HasLDSBase(Rule):
|
class HasLDSBase(Rule):
|
||||||
"""Rule that checks for object with a LDS event"""
|
"""Rule that checks for object with a LDS event"""
|
||||||
|
|
||||||
name = _('Object with LDS event')
|
labels = [ _('Number of instances:'), _('Number must be:')]
|
||||||
description = _("Matches object with LDS event")
|
name = _('Objects with LDS events')
|
||||||
|
description = _("Matches objects with LDS events")
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
|
||||||
|
def prepare(self, db):
|
||||||
|
# things we want to do just once, not for every handle
|
||||||
|
if self.list[1] == _('lesser than'):
|
||||||
|
self.count_type = 0
|
||||||
|
elif self.list[1] == _('greater than'):
|
||||||
|
self.count_type = 2
|
||||||
|
else:
|
||||||
|
self.count_type = 1 # "equal to"
|
||||||
|
|
||||||
|
self.userSelectedCount = int(self.list[0])
|
||||||
|
|
||||||
def apply(self, db, obj):
|
def apply(self, db, obj):
|
||||||
return len( obj.get_lds_ord_list()) > 0
|
count = len( obj.get_lds_ord_list())
|
||||||
|
if self.count_type == 0: # "lesser than"
|
||||||
|
return count < self.userSelectedCount
|
||||||
|
elif self.count_type == 2: # "greater than"
|
||||||
|
return count > self.userSelectedCount
|
||||||
|
# "equal to"
|
||||||
|
return count == self.userSelectedCount
|
||||||
|
@ -41,7 +41,7 @@ from Filters.Rules._Rule import Rule
|
|||||||
class HasNoteBase(Rule):
|
class HasNoteBase(Rule):
|
||||||
"""Objects having notes"""
|
"""Objects having notes"""
|
||||||
|
|
||||||
labels = [ _('Number of instances:'), _('Number must be')]
|
labels = [ _('Number of instances:'), _('Number must be:')]
|
||||||
name = _('Object with notes')
|
name = _('Object with notes')
|
||||||
description = _("Matches objects that have a certain number of notes")
|
description = _("Matches objects that have a certain number of notes")
|
||||||
category = _('General filters')
|
category = _('General filters')
|
||||||
|
Loading…
Reference in New Issue
Block a user