Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Some versioning refactor #1128

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/assistants/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ def version_details(self) -> VersionDetails:
],
)

@property
def versioned_fields(self):
return [field.name for field in self.version_details.fields]


@audit_fields(
"assistant_id",
Expand Down
31 changes: 19 additions & 12 deletions apps/events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,28 @@ def create_new_version(self, new_experiment: Experiment):
new_instance.save()
return new_instance

# @property
# def version_details(self):
# action_param_versions = []
# static_trigger_type = StaticTriggerType(self.type).label.lower()
# event_action_type = EventActionType(self.action.action_type).label
# # Static trigger group names should be user friendly
# group_name = f"When {static_trigger_type} then {event_action_type}"

# for name, value in self.action.params.items():
# action_param_versions.append(VersionField(group_name=group_name, name=name, raw_value=value))

# return VersionDetails(
# instance=self,
# fields=action_param_versions,
# )

@property
def version_details(self):
action_param_versions = []
def versioned_fields(self):
static_trigger_type = StaticTriggerType(self.type).label.lower()
event_action_type = EventActionType(self.action.action_type).label
# Static trigger group names should be user friendly
group_name = f"When {static_trigger_type} then {event_action_type}"

for name, value in self.action.params.items():
action_param_versions.append(VersionField(group_name=group_name, name=name, raw_value=value))

return VersionDetails(
instance=self,
fields=action_param_versions,
)
# for name, value in self.action.params.items():
# action_param_versions.append(VersionField(group_name=group_name, name=name, raw_value=value))


class TimeoutTrigger(BaseModel, VersionsMixin):
Expand Down
Loading
Loading