mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 04:54:18 +00:00
Fixed conditions evaluation mode defaulting to '0' instead of ConditionMode.all_or.
This commit is contained in:
parent
0b9b5e301a
commit
da2a7b9e8b
3 changed files with 4 additions and 4 deletions
|
@ -15,7 +15,7 @@ class Repository(ext.Model):
|
|||
start = ext.Column(ext.DateTime, nullable=True)
|
||||
end = ext.Column(ext.DateTime, nullable=True)
|
||||
is_active = ext.Column(ext.Boolean, nullable=False, default=False)
|
||||
evaluation_mode = ext.Column(ext.Enum(ConditionMode), default=ConditionMode.all_or.value)
|
||||
evaluation_mode = ext.Column(ext.Enum(ConditionMode), default=ConditionMode.all_or)
|
||||
|
||||
# Foreign Keys
|
||||
owner_id = ext.Column(ext.String, ext.ForeignKey("user.email", ondelete="CASCADE"), nullable=False)
|
||||
|
@ -35,6 +35,6 @@ class Repository(ext.Model):
|
|||
"is_active": self.is_active,
|
||||
"end": self.end.isoformat() if self.end else None,
|
||||
"owner": self.owner.to_json(),
|
||||
"evaluation_mode": self.evaluation_mode,
|
||||
"evaluation_mode": self.evaluation_mode.value,
|
||||
"conditions": [c.to_json() for c in self.conditions]
|
||||
}
|
||||
|
|
|
@ -12,4 +12,4 @@ from .Notification import Notification
|
|||
from .Repository import Repository
|
||||
from .Tweet import Tweet
|
||||
from .User import User
|
||||
from .Enums import ConditionType, OperationType
|
||||
from .Enums import ConditionType, OperationType, ConditionMode
|
|
@ -170,7 +170,7 @@ def page_repository(rid):
|
|||
repository.is_active = True
|
||||
if 'evaluation_mode' in request.json:
|
||||
try:
|
||||
evaluation_mode = ConditionType(request.json['evaluation_mode'])
|
||||
evaluation_mode = ConditionMode(request.json['evaluation_mode'])
|
||||
except KeyError:
|
||||
return json_error("Unknown `type` specified."), 400
|
||||
repository.evaluation_mode = evaluation_mode
|
||||
|
|
Loading…
Reference in a new issue