Skip to content

Commit

Permalink
updated the backednd call
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshmi2506 committed Jan 25, 2024
1 parent 2fc2573 commit a2fdd4a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions metecho/api/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,17 +646,17 @@ def get_unsaved_changes(scratch_org, *, originating_user_id):
)
get_unsaved_changes_job = job(get_unsaved_changes)

def get_nonsource_components(*,scratch_org,desired_type,originating_user_id):
def get_nonsource_components(*,scratch_org,desiredType,originating_user_id):
try:
scratch_org.refresh_from_db()
with dataset_env(scratch_org) as (project_config, org_config, sf, schema, repo):
components=ListComponents(
org_config=org_config,
project_config=project_config,
task_config=TaskConfig({"options":{"metadata_type":data}}),
task_config=TaskConfig({"options":{"metadata_type":desiredType}}),
)()

scratch_org.metadatatype_changes[desired_type]=[cmp["MemberName"] for cmp in components]
scratch_org.metadatatype_changes[desiredType]=[cmp["MemberName"] for cmp in components]
except Exception as e:
scratch_org.refresh_from_db()

Expand Down
2 changes: 1 addition & 1 deletion metecho/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ def queue_get_nonsource_components(self,*,originating_user_id,desiredType: str):
self.currently_refreshing_changes = True
self.save()
self.notify_changed(originating_user_id=originating_user_id)
get_nonsource_components_job.delay(self,desired_type=desiredType,originating_user_id=originating_user_id)
get_nonsource_components_job.delay(self,desiredType=desiredType,originating_user_id=originating_user_id)

def finalize_get_unsaved_changes(self, *, error=None, originating_user_id):
self.currently_refreshing_changes = False
Expand Down
3 changes: 1 addition & 2 deletions metecho/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,7 @@ def listmetadata(self,request,pk=None):
{"error": _("Requesting user did not create Org.")},
status=status.HTTP_403_FORBIDDEN,
)
logger.info(serializer.validated_data["desiredType"])
scratch_org.queue_get_nonsource_components(**serializer.validated_data,originating_user_id=str(request.user.id))
scratch_org.queue_get_nonsource_components(desiredType=serializer.validated_data["desiredType"],originating_user_id=str(request.user.id))
return Response(
self.get_serializer(scratch_org).data, status=status.HTTP_202_ACCEPTED
)
Expand Down

0 comments on commit a2fdd4a

Please sign in to comment.