Skip to content

✨ [FEAT] Add filter by creation year and update year to Report list (refs #4085) #4134

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

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

Chatewgne
Copy link
Contributor

@Chatewgne Chatewgne commented May 28, 2024

Description

Filtrer par année de mise à jour ou de création
Sous forme de Mixin pour le rajouter facilement sur les autres modules à l'avenir

image

Related Issue

Checklist

  • I have followed the guidelines in our Contributing document
  • My code respects the Definition of done available in the Development section of the documentation
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes
  • I added an entry in the changelog file
  • My commits are all using prefix convention (emoji + tag name) and references associated issues
  • I added a label to the PR corresponding to the perimeter of my contribution
  • The title of my PR mentionned the issue associated

@Chatewgne Chatewgne changed the title ✨ [FEAT] Add filter by creation year and update year to Report list (… ✨ [FEAT] Add filter by creation year and update year to Report list (refs #4085) May 28, 2024
Copy link

cypress bot commented May 28, 2024

Passing run #9183 ↗︎

0 22 0 0 Flakiness 0

Details:

Merge 2b37bae into a642b55...
Project: Geotrek-admin Commit: a2b3632a43 ℹ️
Status: Passed Duration: 01:54 💡
Started: Jun 3, 2024 8:13 AM Ended: Jun 3, 2024 8:15 AM

Review all test suite changes for PR #4134 ↗︎

@Chatewgne Chatewgne force-pushed the feat_filter_report_by_year branch from db89932 to d4fb5b8 Compare May 30, 2024 14:17
Copy link

codecov bot commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.38%. Comparing base (439ac99) to head (2b37bae).
Report is 9 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4134   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         267      267           
  Lines       20760    20783   +23     
=======================================
+ Hits        20424    20447   +23     
  Misses        336      336           

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

@Chatewgne Chatewgne force-pushed the feat_filter_report_by_year branch 2 times, most recently from e85b891 to e9de056 Compare May 31, 2024 09:20
@Chatewgne Chatewgne requested a review from a team May 31, 2024 10:38
@@ -16,7 +16,7 @@

from . import models as feedback_models
from . import serializers as feedback_serializers
from .filters import ReportFilterSet, ReportNoEmailFilterSet
from .filters import ReportFilterSet, ReportEmailFilterSet
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ces deux noms ont été échangés


class Meta(MapEntityFilterSet.Meta):
model = Report
fields = ['activity', 'category', 'status', 'problem_magnitude', 'assigned_user']
fields = ['activity', 'email', 'category', 'status', 'problem_magnitude', 'assigned_user']
Copy link
Member

Choose a reason for hiding this comment

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

why change email in a filter dedicated PR ?

Copy link
Contributor Author

@Chatewgne Chatewgne May 31, 2024

Choose a reason for hiding this comment

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

I reorganized these two filtersets to

  • have a more logical inheritance
  • not need to duplicate my code by adding the two new filters in both FilterSets

Before :

ReportFilterSet -> filters on 10 fields

ReportNoEmailFilterSet -> filters on 9 fields because it does not include 'email' filter, and does not inherit from ReportFilterSet

After :

ReportFilterSet -> filters on 12 fields
ReportEmailFilterSet -> filters on same 12 fields + 'email' = 13 fields and does inherit from ReportFilterSet


class SelectableUserManager(models.Manager):

def get_queryset(self):
return super().get_queryset().filter(userprofile__isnull=False)


class ReportManager(NoDeleteManager, TimestampedChoicesMixin):
Copy link
Member

@submarcos submarcos May 31, 2024

Choose a reason for hiding this comment

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

If you use NoDeleteMixin, you should use existing everywhere objects is used. In each queryset, else each delete objects is not delete from database, it will be always present in .objects. querysets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The manager for Report already was NoDeleteManager (implicit thanks to NoDeleteMixin), so existing is already called where needed (see views.py), I only added this here to extend it with my TimestampedChoicesMixin like I saw here :

class TrekManager(TopologyManager, ProviderChoicesMixin):

@Chatewgne Chatewgne force-pushed the feat_filter_report_by_year branch from e9de056 to b82aba3 Compare May 31, 2024 14:09
@Chatewgne Chatewgne force-pushed the feat_filter_report_by_year branch from b82aba3 to 2b37bae Compare June 3, 2024 08:02
@Chatewgne Chatewgne merged commit 6641b34 into master Jun 3, 2024
22 checks passed
@Chatewgne Chatewgne deleted the feat_filter_report_by_year branch June 3, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants