openslides_backend/action/actions/motion_submitter/create.py
def update_instance(self, instance: Dict[str, Any]) -> Dict[str, Any]:
        """
        Check if motion and user belong to the same meeting.
        """
        instance = self.update_instance_with_meeting_id(instance)
        meeting_id = instance["meeting_id"]  # meeting_id is set from motion
        if not has_organization_management_level(
            self.datastore, instance["user_id"], OrganizationManagementLevel.SUPERADMIN
        ):
            assert_belongs_to_meeting(
                self.datastore,
                [FullQualifiedId(Collection("user"), instance["user_id"])],
                meeting_id,
            )

        # check, if (user_id, motion_id) already in the datastore.
        filter = And(
            FilterOperator("user_id", "=", instance["user_id"]),
            FilterOperator("motion_id", "=", instance["motion_id"]),
        )
        exists = self.datastore.exists(collection=self.model.collection, filter=filter)
        if exists:
            raise ActionException("(user_id, motion_id) must be unique.")
        if instance.get("weight") is None:
            self.set_weight(instance)
        return instance

        Check if motion and user belong to the same meeting.
        
Check if motion and user belong to the same meeting.
Check if motion and user belong to the same meeting .
def update_instance(self, instance: Dict[str, Any]) -> Dict[str, Any]:
        instance = self.update_instance_with_meeting_id(instance)
        meeting_id = instance["meeting_id"]  
        if not has_organization_management_level(
            self.datastore, instance["user_id"], OrganizationManagementLevel.SUPERADMIN
        ):
            assert_belongs_to_meeting(
                self.datastore,
                [FullQualifiedId(Collection("user"), instance["user_id"])],
                meeting_id,
            )
        filter = And(
            FilterOperator("user_id", "=", instance["user_id"]),
            FilterOperator("motion_id", "=", instance["motion_id"]),
        )
        exists = self.datastore.exists(collection=self.model.collection, filter=filter)
        if exists:
            raise ActionException("(user_id, motion_id) must be unique.")
        if instance.get("weight") is None:
            self.set_weight(instance)
        return instance
def update_instance ( self , instance : Dict [ str , Any ] ) -> Dict [ str , Any ] : instance = self . update_instance_with_meeting_id ( instance ) meeting_id = instance [ "meeting_id" ] if not has_organization_management_level ( self . datastore , instance [ "user_id" ] , OrganizationManagementLevel . SUPERADMIN ) : assert_belongs_to_meeting ( self . datastore , [ FullQualifiedId ( Collection ( "user" ) , instance [ "user_id" ] ) ] , meeting_id , ) filter = And ( FilterOperator ( "user_id" , "=" , instance [ "user_id" ] ) , FilterOperator ( "motion_id" , "=" , instance [ "motion_id" ] ) , ) exists = self . datastore . exists ( collection = self . model . collection , filter = filter ) if exists : raise ActionException ( "(user_id, motion_id) must be unique." ) if instance . get ( "weight" ) is None : self . set_weight ( instance ) return instance
Check if motion and user belong to the same meeting.
Check if motion and user belong to the same meeting .
"""
        Check if motion and user belong to the same meeting.
        """ # meeting_id is set from motion # check, if (user_id, motion_id) already in the datastore.
self
instance
Dict[str, Any]