Skip to content

Commit 3010672

Browse files
committed
Start of actions cleanup
1 parent a20eeb6 commit 3010672

File tree

14 files changed

+16
-42
lines changed

14 files changed

+16
-42
lines changed

docs/actions/motion.create.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ There are some fields that need special attention:
6262
- `agenda_*`: See [Agenda](https://github.com/OpenSlides/OpenSlides/wiki/Agenda#additional-fields-during-creation-of-agenda-content-objects).
6363

6464
Other things to do when creating motions:
65-
- Set the field `sequential_number`: It is the `max+1` of `sequential_number` of all motions in the same meeting. If there are no other motions in this meeting (e.g. this is the first one), it gets 1.
6665
- Set timestamps:
6766
- always set `last_modified` and `created` to the current timestamp
6867
- if the state pointed to by `first_state_id` of the given workflow has the flag `set_workflow_timestamp` set, also set `workflow_timestamp`to the current timestamp.
@@ -98,7 +97,7 @@ This is the procedure to determine what to set for the field `number`:
9897
* Remember: `number` must be unique. If a motion with this number already exists, increment `number_value` by one and go to the last step (the prefix is the same, the number incremented - try again).
9998
* If there is a unique `number`, save it into the motion. Done!
10099
* Note: The complete calculation is restricted to motions and other objects from the same meeting.
101-
100+
102101
### Some examples for determinating the number. First comes the general setup and the test cases are numbered:
103102
104103
`meeting/motions_number_type="manually"`

docs/actions/motion.create_forwarded.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ The result object for each instance has the format
5656
```
5757
{
5858
id: Id,
59-
sequential_number: int,
6059
non_forwarded_amendment_amount: int, // Number of amendments that couldn't be returned because of forwarding being not allowed in the state
6160
amendment_result_data: [...], // List of result data objects in the same format, for all newly created amendments for the newly created motion
6261
}

openslides_backend/action/actions/list_of_speakers/create.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
from ...mixins.create_action_with_inferred_meeting import (
66
CreateActionWithInferredMeeting,
77
)
8-
from ...mixins.sequential_numbers_mixin import SequentialNumbersMixin
98
from ...util.default_schema import DefaultSchema
109

1110

1211
# This action is not registered because you can not call it from outside.
13-
class ListOfSpeakersCreate(SequentialNumbersMixin, CreateActionWithInferredMeeting):
12+
class ListOfSpeakersCreate(CreateActionWithInferredMeeting):
1413
name = "list_of_speakers.create"
1514
model = ListOfSpeakers()
1615
schema = DefaultSchema(ListOfSpeakers()).get_create_schema(["content_object_id"])

openslides_backend/action/actions/motion/base_create_forwarded.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ def update_instance(self, instance: dict[str, Any]) -> dict[str, Any]:
197197
else:
198198
name = committee.get("name", f"Committee {committee['id']}")
199199
instance["additional_submitter"] = name
200-
201-
self.set_sequential_number(instance)
202200
self.handle_number(instance)
203201
self.set_origin_ids(instance)
204202
self.set_text_hash(instance)

openslides_backend/action/actions/motion/create.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def update_instance(self, instance: dict[str, Any]) -> dict[str, Any]:
131131

132132
self.set_state_from_workflow(instance, meeting)
133133
self.create_submitters(instance)
134-
self.set_sequential_number(instance)
135134
self.set_created_last_modified_and_number(instance)
136135
self.set_text_hash(instance)
137136
instance = super().update_instance(instance)

openslides_backend/action/actions/motion/create_base.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from ....models.models import Motion
66
from ....shared.patterns import fqid_from_collection_and_id
77
from ...mixins.create_action_with_dependencies import CreateActionWithDependencies
8-
from ...mixins.sequential_numbers_mixin import SequentialNumbersMixin
98
from ..agenda_item.agenda_creation import CreateActionWithAgendaItemMixin
109
from ..agenda_item.create import AgendaItemCreate
1110
from ..list_of_speakers.create import ListOfSpeakersCreate
@@ -22,7 +21,6 @@ class MotionCreateBase(
2221
MeetingUserHelperMixin,
2322
CreateActionWithDependencies,
2423
CreateActionWithAgendaItemMixin,
25-
SequentialNumbersMixin,
2624
SetNumberMixin,
2725
CreateActionWithListOfSpeakersMixin,
2826
):
@@ -64,11 +62,6 @@ def create_submitters(self, instance: dict[str, Any]) -> None:
6462
MotionSubmitterCreateAction, [data], skip_history=True
6563
)
6664

67-
def set_sequential_number(self, instance: dict[str, Any]) -> None:
68-
instance["sequential_number"] = self.get_sequential_number(
69-
instance["meeting_id"]
70-
)
71-
7265
def set_created_last_modified_and_number(self, instance: dict[str, Any]) -> None:
7366
self.set_created_last_modified(instance)
7467
self.set_number(

openslides_backend/action/actions/poll/create.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from ....shared.schema import decimal_schema, id_list_schema, optional_fqid_schema
99
from ...generics.create import CreateAction
1010
from ...mixins.forbid_anonymous_group_mixin import ForbidAnonymousGroupMixin
11-
from ...mixins.sequential_numbers_mixin import SequentialNumbersMixin
1211
from ...util.default_schema import DefaultSchema
1312
from ...util.register import register_action
1413
from ..option.create import OptionCreateAction
@@ -33,7 +32,6 @@
3332
@register_action("poll.create")
3433
class PollCreateAction(
3534
PollValidationMixin,
36-
SequentialNumbersMixin,
3735
CreateAction,
3836
PollPermissionMixin,
3937
PollHistoryMixin,

openslides_backend/action/actions/projector/create.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
from ....models.models import Meeting, Projector
22
from ....permissions.permissions import Permissions
33
from ...generics.create import CreateAction
4-
from ...mixins.sequential_numbers_mixin import SequentialNumbersMixin
54
from ...util.default_schema import DefaultSchema
65
from ...util.register import register_action
76

87

98
@register_action("projector.create")
10-
class ProjectorCreateAction(SequentialNumbersMixin, CreateAction):
9+
class ProjectorCreateAction(CreateAction):
1110
"""
1211
Action to create a projector.
1312
"""

openslides_backend/action/actions/topic/create.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from ....shared.schema import id_list_schema
66
from ...action import Action
77
from ...mixins.create_action_with_dependencies import CreateActionWithDependencies
8-
from ...mixins.sequential_numbers_mixin import SequentialNumbersMixin
98
from ...util.default_schema import DefaultSchema
109
from ...util.register import register_action
1110
from ..agenda_item.agenda_creation import (
@@ -23,7 +22,6 @@
2322
@register_action("topic.create")
2423
class TopicCreate(
2524
AttachmentMixin,
26-
SequentialNumbersMixin,
2725
CreateActionWithDependencies,
2826
CreateActionWithAgendaItemMixin,
2927
CreateActionWithListOfSpeakersMixin,

openslides_backend/models/fields.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ def get_schema(self) -> Schema:
121121
def check_required_not_fulfilled(
122122
self, instance: dict[str, Any], is_create: bool
123123
) -> bool:
124+
if self.constraints.get("sequence_scope"):
125+
return False
124126
if self.own_field_name not in instance:
125127
return is_create
126128
return instance[self.own_field_name] is None

0 commit comments

Comments
 (0)