Skip to content

Commit

Permalink
Fix complaint models
Browse files Browse the repository at this point in the history
  • Loading branch information
cgokmen committed Mar 5, 2025
1 parent 6e8101d commit 9befec9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion bddl/knowledge_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
RoomSynsetRequirement, \
Room, \
RoomObject, \
AttachmentPair
AttachmentPair, \
ComplaintType, \
Complaint

from bddl.knowledge_base.utils import SynsetState

Expand Down
1 change: 1 addition & 0 deletions bddl/knowledge_base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ class Meta:
pk = "message"
ordering = ["message"]

@cached_property
def objects(self):
return [complaint.object for complaint in self.complaints]

Expand Down
4 changes: 2 additions & 2 deletions bddl/knowledge_base/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def create_transitions(self):
machine = Synset.get(name=synset_name)
transition.machine_synsets.add(machine)

def create_complaints():
def create_complaints(self):
with open(GENERATED_DATA_DIR / "complaints.json", "r") as f:
complaints = json.load(f)

Expand All @@ -401,7 +401,7 @@ def create_complaints():
continue

# Create the relevant objects
complaint_type, created = Synset.get_or_create(message=complaint_message)
complaint_type, created = ComplaintType.get_or_create(message=complaint_message)
Complaint.create(object=obj, complaint_type=complaint_type, content=complaint_content)

# TODO: Move to cached property on Synset
Expand Down

0 comments on commit 9befec9

Please sign in to comment.