Merge pull request #6285 from jsangmeister/restrictions-fix
Various fixes for the exporter
This commit is contained in:
commit
4efc591d21
@ -15,6 +15,7 @@ from openslides.mediafiles.views import (
|
|||||||
)
|
)
|
||||||
from openslides.motions.models import Motion
|
from openslides.motions.models import Motion
|
||||||
from openslides.users.views import demo_mode_users, is_demo_mode
|
from openslides.users.views import demo_mode_users, is_demo_mode
|
||||||
|
from openslides.utils import logging
|
||||||
from openslides.utils.cache import element_cache
|
from openslides.utils.cache import element_cache
|
||||||
|
|
||||||
|
|
||||||
@ -198,7 +199,7 @@ class OS4Exporter:
|
|||||||
|
|
||||||
# Note: When returning self.all_data one has access to the original data to compare it to the export.
|
# Note: When returning self.all_data one has access to the original data to compare it to the export.
|
||||||
# return {"all": self.all_data, "export": self.to_list_format()}
|
# return {"all": self.all_data, "export": self.to_list_format()}
|
||||||
return self.to_list_format()
|
return self.data
|
||||||
|
|
||||||
def set_model(self, collection, model):
|
def set_model(self, collection, model):
|
||||||
if model["id"] in self.data[collection]:
|
if model["id"] in self.data[collection]:
|
||||||
@ -419,7 +420,6 @@ class OS4Exporter:
|
|||||||
"is_pseudoanonymized",
|
"is_pseudoanonymized",
|
||||||
"pollmethod",
|
"pollmethod",
|
||||||
"onehundred_percent_base",
|
"onehundred_percent_base",
|
||||||
"majority_method",
|
|
||||||
"votesvalid",
|
"votesvalid",
|
||||||
"votesinvalid",
|
"votesinvalid",
|
||||||
"votescast",
|
"votescast",
|
||||||
@ -869,15 +869,24 @@ class OS4Exporter:
|
|||||||
new["css_class"] = old["css_class"]
|
new["css_class"] = old["css_class"]
|
||||||
else:
|
else:
|
||||||
new["css_class"] = "lightblue"
|
new["css_class"] = "lightblue"
|
||||||
new["restrictions"] = [
|
new["weight"] = old["id"]
|
||||||
{
|
|
||||||
"motions.can_see_internal": "motion.can_see_internal",
|
new["restrictions"] = []
|
||||||
"motions.can_manage_metadata": "motion.can_manage_metadata",
|
restrictions_map = {
|
||||||
"motions.can_manage": "motion.can_manage",
|
"motions.can_see_internal": "motion.can_see_internal",
|
||||||
"is_submitter": "is_submitter",
|
"motions.can_manage_metadata": "motion.can_manage_metadata",
|
||||||
}[restriction]
|
"motions.can_manage": "motion.can_manage",
|
||||||
for restriction in old["restriction"]
|
"managers_only": "motion.can_manage", # Should not exist any more since migration 0026, but does anyway...
|
||||||
]
|
"is_submitter": "is_submitter",
|
||||||
|
}
|
||||||
|
for restriction in old["restriction"]:
|
||||||
|
if restriction in restrictions_map:
|
||||||
|
new["restrictions"].append(restrictions_map[restriction])
|
||||||
|
else:
|
||||||
|
logging.getLogger(__name__).warn(
|
||||||
|
f"Invalid restriction '{restriction}' for motion {old['id']} is ignored."
|
||||||
|
)
|
||||||
|
|
||||||
new["set_number"] = not old["dont_set_identifier"]
|
new["set_number"] = not old["dont_set_identifier"]
|
||||||
new["merge_amendment_into_final"] = {
|
new["merge_amendment_into_final"] = {
|
||||||
-1: "do_not_merge",
|
-1: "do_not_merge",
|
||||||
@ -1023,6 +1032,9 @@ class OS4Exporter:
|
|||||||
"gender",
|
"gender",
|
||||||
"email",
|
"email",
|
||||||
)
|
)
|
||||||
|
# remove invalid genders
|
||||||
|
if new["gender"] not in ("male", "female", "diverse"):
|
||||||
|
new["gender"] = None
|
||||||
|
|
||||||
new["is_physical_person"] = not old["is_committee"]
|
new["is_physical_person"] = not old["is_committee"]
|
||||||
new["password"] = ""
|
new["password"] = ""
|
||||||
@ -1405,9 +1417,30 @@ class OS4Exporter:
|
|||||||
self.meeting["conference_auto_connect_next_speakers"] = configs[
|
self.meeting["conference_auto_connect_next_speakers"] = configs[
|
||||||
"general_system_conference_auto_connect_next_speakers"
|
"general_system_conference_auto_connect_next_speakers"
|
||||||
]
|
]
|
||||||
|
self.meeting["conference_enable_helpdesk"] = configs[
|
||||||
|
"general_system_conference_enable_helpdesk"
|
||||||
|
]
|
||||||
|
|
||||||
# TODO: missing setting in OS4
|
self.meeting["applause_enable"] = configs["general_system_applause_enable"]
|
||||||
# self.meeting["conference_enable_helpdesk"] = configs["general_system_conference_enable_helpdesk"]
|
self.meeting["applause_type"] = configs["general_system_applause_type"]
|
||||||
|
self.meeting["applause_show_level"] = configs[
|
||||||
|
"general_system_applause_show_level"
|
||||||
|
]
|
||||||
|
self.meeting["applause_min_amount"] = configs[
|
||||||
|
"general_system_applause_min_amount"
|
||||||
|
]
|
||||||
|
self.meeting["applause_max_amount"] = configs[
|
||||||
|
"general_system_applause_max_amount"
|
||||||
|
]
|
||||||
|
self.meeting["applause_particle_image_url"] = configs[
|
||||||
|
"general_system_applause_particle_image"
|
||||||
|
]
|
||||||
|
self.meeting["applause_timeout"] = configs[
|
||||||
|
"general_system_stream_applause_timeout"
|
||||||
|
]
|
||||||
|
self.meeting["applause_timeout"] = configs[
|
||||||
|
"general_system_stream_applause_timeout"
|
||||||
|
]
|
||||||
|
|
||||||
self.meeting["projector_countdown_default_time"] = configs[
|
self.meeting["projector_countdown_default_time"] = configs[
|
||||||
"projector_default_countdown"
|
"projector_default_countdown"
|
||||||
@ -1525,7 +1558,10 @@ class OS4Exporter:
|
|||||||
self.meeting["motions_recommendation_text_mode"] = configs[
|
self.meeting["motions_recommendation_text_mode"] = configs[
|
||||||
"motions_recommendation_text_mode"
|
"motions_recommendation_text_mode"
|
||||||
]
|
]
|
||||||
self.meeting["motions_default_sorting"] = configs["motions_motions_sorting"]
|
self.meeting["motions_default_sorting"] = {
|
||||||
|
"identifier": "number",
|
||||||
|
"weight": "weight",
|
||||||
|
}[configs["motions_motions_sorting"]]
|
||||||
self.meeting["motions_number_type"] = configs["motions_identifier"]
|
self.meeting["motions_number_type"] = configs["motions_identifier"]
|
||||||
self.meeting["motions_number_min_digits"] = configs[
|
self.meeting["motions_number_min_digits"] = configs[
|
||||||
"motions_identifier_min_digits"
|
"motions_identifier_min_digits"
|
||||||
@ -1572,9 +1608,6 @@ class OS4Exporter:
|
|||||||
self.meeting["motion_poll_default_100_percent_base"] = configs[
|
self.meeting["motion_poll_default_100_percent_base"] = configs[
|
||||||
"motion_poll_default_100_percent_base"
|
"motion_poll_default_100_percent_base"
|
||||||
]
|
]
|
||||||
self.meeting["motion_poll_default_majority_method"] = configs[
|
|
||||||
"motion_poll_default_majority_method"
|
|
||||||
]
|
|
||||||
|
|
||||||
group_ids = configs["motion_poll_default_groups"]
|
group_ids = configs["motion_poll_default_groups"]
|
||||||
for group_id in group_ids:
|
for group_id in group_ids:
|
||||||
@ -1627,9 +1660,6 @@ class OS4Exporter:
|
|||||||
self.meeting["assignment_poll_default_100_percent_base"] = configs[
|
self.meeting["assignment_poll_default_100_percent_base"] = configs[
|
||||||
"assignment_poll_default_100_percent_base"
|
"assignment_poll_default_100_percent_base"
|
||||||
]
|
]
|
||||||
self.meeting["assignment_poll_default_majority_method"] = configs[
|
|
||||||
"assignment_poll_default_majority_method"
|
|
||||||
]
|
|
||||||
|
|
||||||
group_ids = configs["assignment_poll_default_groups"]
|
group_ids = configs["assignment_poll_default_groups"]
|
||||||
for group_id in group_ids:
|
for group_id in group_ids:
|
||||||
@ -1643,7 +1673,6 @@ class OS4Exporter:
|
|||||||
self.meeting["poll_default_type"] = "analog"
|
self.meeting["poll_default_type"] = "analog"
|
||||||
self.meeting["poll_default_method"] = "Y"
|
self.meeting["poll_default_method"] = "Y"
|
||||||
self.meeting["poll_default_100_percent_base"] = "YNA"
|
self.meeting["poll_default_100_percent_base"] = "YNA"
|
||||||
self.meeting["poll_default_majority_method"] = "simple"
|
|
||||||
self.meeting["poll_default_group_ids"] = []
|
self.meeting["poll_default_group_ids"] = []
|
||||||
self.meeting["poll_couple_countdown"] = True
|
self.meeting["poll_couple_countdown"] = True
|
||||||
|
|
||||||
@ -1690,6 +1719,7 @@ class OS4Exporter:
|
|||||||
|
|
||||||
self.meeting["committee_id"] = None
|
self.meeting["committee_id"] = None
|
||||||
self.meeting["default_meeting_for_committee_id"] = None
|
self.meeting["default_meeting_for_committee_id"] = None
|
||||||
|
self.meeting["is_active_in_organization_id"] = None
|
||||||
self.meeting["organization_tag_ids"] = []
|
self.meeting["organization_tag_ids"] = []
|
||||||
self.meeting["present_user_ids"] = [
|
self.meeting["present_user_ids"] = [
|
||||||
x["id"]
|
x["id"]
|
||||||
|
Loading…
Reference in New Issue
Block a user