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

Add duplication on objects #3212

Merged
merged 34 commits into from
Jan 20, 2023
Merged

Add duplication on objects #3212

merged 34 commits into from
Jan 20, 2023

Conversation

LePetitTim
Copy link
Contributor

No description provided.

@cypress
Copy link

cypress bot commented Aug 12, 2022



Test summary

24 0 0 0


Run details

Project Geotrek-admin
Status Passed
Commit 06fe594 ℹ️
Started Jan 20, 2023 5:06 PM
Ended Jan 20, 2023 5:10 PM
Duration 04:34 💡
OS Linux Ubuntu - 20.04
Browser Electron 94

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@codecov
Copy link

codecov bot commented Aug 23, 2022

Codecov Report

Base: 98.23% // Head: 98.23% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (b25adb9) compared to base (17bcdc5).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head b25adb9 differs from pull request most recent head f050424. Consider uploading reports for the commit f050424 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3212   +/-   ##
=======================================
  Coverage   98.23%   98.23%           
=======================================
  Files         291      291           
  Lines       20778    20848   +70     
=======================================
+ Hits        20412    20481   +69     
- Misses        366      367    +1     
Impacted Files Coverage Δ
geotrek/altimetry/management/commands/loaddem.py 100.00% <100.00%> (ø)
geotrek/api/v2/serializers.py 99.89% <100.00%> (+<0.01%) ⬆️
geotrek/api/v2/viewsets.py 100.00% <100.00%> (ø)
geotrek/common/parsers.py 93.09% <100.00%> (+0.04%) ⬆️
geotrek/outdoor/models.py 99.66% <100.00%> (+<0.01%) ⬆️
geotrek/trekking/parsers.py 99.83% <100.00%> (-0.17%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@LePetitTim LePetitTim marked this pull request as ready for review August 24, 2022 15:32
@LePetitTim LePetitTim requested a review from a team August 24, 2022 15:32
@LePetitTim LePetitTim changed the title Add duplication on signage (test) Add duplication on objects Aug 25, 2022
@camillemonchicourt
Copy link
Member

En lien avec #2543 et #3105 ?

Cela va rajouter la fonctionnalité de duplication au niveau de l'interface de Geotrek-admin ?
Si oui, depuis la liste des objets d'un module, ou depuis la fiche détail d'un objet ?

@LePetitTim
Copy link
Contributor Author

En lien avec #2543 et #3105 ?

Cela va rajouter la fonctionnalité de duplication au niveau de l'interface de Geotrek-admin ? Si oui, depuis la liste des objets d'un module, ou depuis la fiche détail d'un objet ?

Depuis la liste des objets d'un module.

Et c'est en lien avec #2543 , #3105 et #3126

@LePetitTim LePetitTim requested a review from a team August 26, 2022 09:20
Copy link
Member

@submarcos submarcos left a comment

Choose a reason for hiding this comment

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

I suggest :

  • use duplicate only in detail view with button, not in list views (avoid problems)
  • unpublished publishable instances
  • duplicate attachments / attachments accessibility WITH document duplication (avoid problem if document deleted by a duplicate attachment)

obj.pk = None
obj.uuid = uuid.uuid4()
if 'name' in [field.name for field in self.__class__._meta.get_fields()]:
obj.name = f'{self.name} (copy)'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
obj.name = f'{self.name} (copy)'
obj.name = f'[_("Copy")] {self.name}'

# Duplicate the object and save it.
obj.id = None
obj.pk = None
obj.uuid = uuid.uuid4()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
obj.uuid = uuid.uuid4()
obj.uuid = None

I think that with default value uuid is automaticaly generated (to verify)

for obj in sub_objects:
# Duplicate the object and save it.
obj.id = None
obj.pk = None
Copy link
Member

Choose a reason for hiding this comment

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

use pk or id. pk is an alias to id. I suggest to only change pk

@LePetitTim LePetitTim force-pushed the add_duplicate_action branch from ec6837e to 263cd4c Compare August 31, 2022 14:19
@LePetitTim LePetitTim force-pushed the add_duplicate_action branch from d8392c8 to bcb1d97 Compare October 5, 2022 08:10
@LePetitTim LePetitTim force-pushed the add_duplicate_action branch 2 times, most recently from 325caf8 to f8656cb Compare December 16, 2022 15:21
@LePetitTim LePetitTim force-pushed the add_duplicate_action branch from 838aca1 to 6c561d5 Compare January 17, 2023 16:09
Copy link
Contributor

@numahell numahell left a comment

Choose a reason for hiding this comment

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

Nice job !

@@ -26,6 +26,7 @@ class PhysicalEdgeList(CustomColumnsMixin, CreateFromTopologyMixin, MapEntityLis


class PhysicalEdgeFormatList(MapEntityFormat, PhysicalEdgeList):
mandatory_columns = ['id', 'physical_type']
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it related to duplicate ?

@LePetitTim LePetitTim force-pushed the add_duplicate_action branch from f050424 to 8999182 Compare January 20, 2023 16:50
@LePetitTim LePetitTim merged commit 8adecb3 into master Jan 20, 2023
@LePetitTim LePetitTim deleted the add_duplicate_action branch January 20, 2023 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants