openslides_backend/action/actions/motion_category/number_motions.py
def init_memory(self, main_category_id: int) -> None:
        """Preload all categories with needed fields, all motions with needed fields
        and meeting with needed fields."""
        category = self.datastore.get(
            FullQualifiedId(Collection("motion_category"), main_category_id),
            ["meeting_id"],
        )
        self.main_category_id = main_category_id

        if category.get("meeting_id"):
            meeting = self.datastore.get(
                FullQualifiedId(Collection("meeting"), category["meeting_id"]),
                [
                    "motion_ids",
                    "motion_category_ids",
                    "motions_number_with_blank",
                    "motions_number_min_digits",
                    "motions_amendments_prefix",
                ],
            )
            self.meeting = meeting
        else:
            raise ActionException("Main category doesnt include meeting_id.")

        gmr_categories = GetManyRequest(
            Collection("motion_category"),
            meeting.get("motion_category_ids", []),
            ["prefix", "parent_id", "child_ids", "weight", "motion_ids"],
        )
        gmr_motions = GetManyRequest(
            Collection("motion"),
            meeting.get("motion_ids", []),
            [
                "lead_motion_id",
                "category_weight",
                "category_id",
                "number",
            ],
        )
        result = self.datastore.get_many([gmr_categories, gmr_motions])
        self.mem_categories = result.get(Collection("motion_category"), {})
        self.mem_motions = result.get(Collection("motion"), {})
        self.mem_meetings = {category.get("meeting_id"): meeting}
Preload all categories with needed fields, all motions with needed fields
        and meeting with needed fields.
Preload all categories with needed fields, all motions with needed fields
and meeting with needed fields.
Preload all categories with needed fields all motions with needed fields and meeting with needed fields .
def init_memory(self, main_category_id: int) -> None:
        category = self.datastore.get(
            FullQualifiedId(Collection("motion_category"), main_category_id),
            ["meeting_id"],
        )
        self.main_category_id = main_category_id
        if category.get("meeting_id"):
            meeting = self.datastore.get(
                FullQualifiedId(Collection("meeting"), category["meeting_id"]),
                [
                    "motion_ids",
                    "motion_category_ids",
                    "motions_number_with_blank",
                    "motions_number_min_digits",
                    "motions_amendments_prefix",
                ],
            )
            self.meeting = meeting
        else:
            raise ActionException("Main category doesnt include meeting_id.")
        gmr_categories = GetManyRequest(
            Collection("motion_category"),
            meeting.get("motion_category_ids", []),
            ["prefix", "parent_id", "child_ids", "weight", "motion_ids"],
        )
        gmr_motions = GetManyRequest(
            Collection("motion"),
            meeting.get("motion_ids", []),
            [
                "lead_motion_id",
                "category_weight",
                "category_id",
                "number",
            ],
        )
        result = self.datastore.get_many([gmr_categories, gmr_motions])
        self.mem_categories = result.get(Collection("motion_category"), {})
        self.mem_motions = result.get(Collection("motion"), {})
        self.mem_meetings = {category.get("meeting_id"): meeting}
def init_memory ( self , main_category_id : int ) -> None : category = self . datastore . get ( FullQualifiedId ( Collection ( "motion_category" ) , main_category_id ) , [ "meeting_id" ] , ) self . main_category_id = main_category_id if category . get ( "meeting_id" ) : meeting = self . datastore . get ( FullQualifiedId ( Collection ( "meeting" ) , category [ "meeting_id" ] ) , [ "motion_ids" , "motion_category_ids" , "motions_number_with_blank" , "motions_number_min_digits" , "motions_amendments_prefix" , ] , ) self . meeting = meeting else : raise ActionException ( "Main category doesnt include meeting_id." ) gmr_categories = GetManyRequest ( Collection ( "motion_category" ) , meeting . get ( "motion_category_ids" , [ ] ) , [ "prefix" , "parent_id" , "child_ids" , "weight" , "motion_ids" ] , ) gmr_motions = GetManyRequest ( Collection ( "motion" ) , meeting . get ( "motion_ids" , [ ] ) , [ "lead_motion_id" , "category_weight" , "category_id" , "number" , ] , ) result = self . datastore . get_many ( [ gmr_categories , gmr_motions ] ) self . mem_categories = result . get ( Collection ( "motion_category" ) , { } ) self . mem_motions = result . get ( Collection ( "motion" ) , { } ) self . mem_meetings = { category . get ( "meeting_id" ) : meeting }
Preload all categories with needed fields, all motions with needed fields
and meeting with needed fields.
Preload all categories with needed fields all motions with needed fields and meeting with needed fields .
"""Preload all categories with needed fields, all motions with needed fields
        and meeting with needed fields."""
self
main_category_id
int