Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show private activities too on calender when logged in #333

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

LenaWil
Copy link
Contributor

@LenaWil LenaWil commented Sep 18, 2023

Otherwise they are so hidden that it is useless. I am still working on the pr, but what do y’all think?

(I couldn’t quickly find where to set the user in the test)

Todo:

  • fix tests that fail currently.
  • write test logging out and in with activities.
  • check layout webpage. maybe edit to make clear it works on Apple packages.

Copy link
Contributor

@EricTRL EricTRL left a comment

Choose a reason for hiding this comment

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

I agree with the changes, but tests should be added.

Each TestCase class has a client attribute. You can set a user there through self.client.force_login(<user>). If you're working with raw requests, you can set the Request.user attribute directly as well.

Activity.objects.filter(published_date__lte=timezone.now())
.filter(
Q(type=ActivityType.ACTIVITY_PUBLIC)
| (Q(type=ActivityType.ACTIVITY_MEETING) & Q(organisers__members=self.request.member))
Copy link
Contributor

@EricTRL EricTRL Sep 22, 2023

Choose a reason for hiding this comment

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

I'm not sure what will happen if self.request.member = None. Might be useful to check that condition first just to be safe. Something along the lines of (pseudocode):

q = Q(PUBLIC-Q)
if member is not None:
    q |= Q(MEETINGS-Q)
for activity in Activity.objects.filter(q):
    ...

@LenaWil
Copy link
Contributor Author

LenaWil commented Sep 29, 2023

You can set a user there through self.client.force_login(<user>).

How do you log out an user, self.client.force_login(None)?

Edit: logout().
Didn’t see that. 😅

Add a flake8 config file with a max line length so that stops complaining
Add some pytest plugings so I can run the tests from VS code
Some formatting changes
Add if statement to check if member is none
Try to change the input of the private meetings of the calendar (not finished yet)
Add a button to subscribe to private meetings of the calendar (not finished yet)

todo: tests
@LenaWil LenaWil force-pushed the activity-meeting-maincalendar branch from 6e639a3 to 054284c Compare September 30, 2023 12:59
@LenaWil LenaWil force-pushed the activity-meeting-maincalendar branch from b9fd856 to 1aae130 Compare September 30, 2023 13:08
@codecov
Copy link

codecov bot commented Sep 30, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (308b47e) 95.84% compared to head (a0d7407) 95.81%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #333      +/-   ##
==========================================
- Coverage   95.84%   95.81%   -0.04%     
==========================================
  Files         161      161              
  Lines        7118     7137      +19     
  Branches     1166     1169       +3     
==========================================
+ Hits         6822     6838      +16     
- Misses        194      196       +2     
- Partials      102      103       +1     
Flag Coverage Δ
unittests 95.81% <91.66%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
achievements/account_pages/config.py 100.00% <ø> (ø)
achievements/admin.py 100.00% <ø> (ø)
activity_calendar/committee_pages/forms.py 93.33% <100.00%> (+0.06%) ⬆️
activity_calendar/templatetags/calendar_tags.py 64.70% <ø> (ø)
activity_calendar/url_converters.py 100.00% <100.00%> (ø)
activity_calendar/widgets.py 100.00% <100.00%> (ø)
committees/admin/options.py 90.47% <ø> (ø)
...tees/templatetags/association_group_config_tags.py 100.00% <ø> (ø)
core/shortcut_urls.py 100.00% <ø> (ø)
core/templatetags/build_absolute_uri.py 100.00% <100.00%> (ø)
... and 10 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants