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

IA-3456 improve get or create for orgunit (duplicate on uuid) #1661

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mestachs
Copy link
Contributor

@mestachs mestachs commented Sep 30, 2024

To minize duplicate and be "ready" when we will introduce the unique index

Related JIRA tickets : IA-3456

Self proofreading checklist

  • Did I use eslint and black formatters
  • Is my code clear enough and well documented
  • Are my typescript files well typed
  • New translations have been added or updated if new strings have been introduced in the frontend
  • My migrations file are included
  • Are there enough tests
  • Documentation has been included (for new feature)

Doc

  • Tell us where the doc can be found (docs folder, wiki, in the code...)

Changes

see #1652

How to test

see #1652
but the mobile unit test does that

for a more "real life" reproduction : https://gist.github.com/mestachs/2cc50bf310996d14cc48623a05d42caf

note that we have historical data so we will need an intermediate cleanup
create the a temporary index as in the _notes.md
then really cleanup "old data" and all environments (harder)

Print screen / video

Upload here print screens or videos showing the changes

Notes

Things that the reviewers should know: known bugs that are out of the scope of the PR, other trade-offs that were made.
If the PR depends on a PR in bluesquare-components, or merges into another PR (i.o. main), it should also be mentioned here

@mestachs mestachs marked this pull request as ready for review September 30, 2024 15:02
@beygorghor beygorghor added the release Should be released in production at next deploy label Oct 4, 2024
@mestachs mestachs changed the title IA-3456 improve get or create IA-3456 improve get or create for orgunit (duplicate on uuid) Oct 4, 2024
@@ -686,6 +686,7 @@ def instance_logs(self, request, pk=None, logId=None):

def import_data(instances, user, app_id):
project = Project.objects.get_for_user_and_app_id(user, app_id)
default_version = project.account.default_version
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's possible to not have a default version on an account. I think that situation would probably blow up anyways, but not sure if we should consider it here 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

@beygorghor I think we already had to code special cases when there is no default_version so it can happen right ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes indeed, the frontend allows no default version

def import_data(org_units, user, app_id):
new_org_units = []
project = Project.objects.get_for_user_and_app_id(user, app_id)
org_units = sorted(org_units, key=get_timestamp)

project = Project.objects.get_for_user_and_app_id(user, app_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate of line 347?

Copy link
Collaborator

@mathvdh mathvdh left a comment

Choose a reason for hiding this comment

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

See comments from Bram, otherwise it seems ok to me

@@ -686,6 +686,7 @@ def instance_logs(self, request, pk=None, logId=None):

def import_data(instances, user, app_id):
project = Project.objects.get_for_user_and_app_id(user, app_id)
default_version = project.account.default_version
Copy link
Collaborator

Choose a reason for hiding this comment

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

@beygorghor I think we already had to code special cases when there is no default_version so it can happen right ?

@kemar kemar removed the release Should be released in production at next deploy label Oct 8, 2024
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.

5 participants