Skip to content

Add configuration flags to ActivityCalendar to keep events within business hours & days.#1004

Draft
joehybird wants to merge 2 commits into
mainfrom
fix/calendar_forbid_events_for_days_off
Draft

Add configuration flags to ActivityCalendar to keep events within business hours & days.#1004
joehybird wants to merge 2 commits into
mainfrom
fix/calendar_forbid_events_for_days_off

Conversation

@joehybird
Copy link
Copy Markdown
Contributor

No description provided.

@joehybird joehybird requested a review from genglert July 23, 2025 15:18
@joehybird joehybird self-assigned this Jul 23, 2025
@joehybird joehybird added the enhancement New feature or request label Jul 23, 2025
msgid ""
"The activity is not within the business hours range from {day_start} to "
"{day_end}."
msgstr "L'activité est en dehors des heures travaillées de {day_start} à {day_end}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing final dot in fr.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename '0031_v2_7__calendarconfigitem_allow_event_anyday_n_overtime.py'

Comment thread CHANGELOG.txt
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing new features

Comment thread creme/activities/tests/test_activity.py Outdated
Comment on lines +2101 to +2104
config = CalendarConfigItem(role=role)
config.allow_event_overtime = True
config.allow_event_anyday = True
config.save()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config = CalendarConfigItem.objects.create(role=role, allow_event_overtime=True, allow_event_anyday=True)

Comment thread creme/activities/tests/test_activity.py Outdated
Comment on lines +2098 to +2099
user = self.create_user(role=role, password='test')
other_user = self.create_user(username='other', role=other_role, password='test')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user1 = self.login_as_standard()  # then use user1.role
user2 = self.create_user(index=1, role=self.get_regular_role())  # then use user2.role

(You are creating 2 users with the same first_name/last_name)

Comment thread creme/activities/views/calendar.py Outdated
Comment on lines +402 to +405
owner = get_user_model().filter(pk=activity.user_id).first()

if owner is None:
owner = user
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand sometimes the owner of the activity has not been assigned yet

  1. A simpler code would be owner = activity.user if activity.user_id else user
  2. I do not understand the logic. I presume the hours constraints concern the participants, & so the activity should be checked with the config items of the users participants; the owner of the activity & the logged user seem not relevant.

Copy link
Copy Markdown
Contributor Author

@joehybird joehybird Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, you've gone straight to the point that is bothering me 😅 : whom constraint should be used ?
I didn't though about the participants... If I understand we should apply the constraints of ALL the participants to the event movement. 🤔

@joehybird joehybird force-pushed the fix/calendar_forbid_events_for_days_off branch from 14cdc28 to b5c8a71 Compare July 26, 2025 09:49
@joehybird joehybird force-pushed the fix/calendar_forbid_events_for_days_off branch from b5c8a71 to d066117 Compare January 12, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants