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

Analysis Module: Implement Analysis Mutation to setup a new analysis #1516

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

sauravsapkota
Copy link
Contributor

@sauravsapkota sauravsapkota commented Jul 24, 2024

Addresses

Changes

Convert REST API for Analysis CRUD to GraphQL mutation

This PR doesn't introduce any:

  • temporary files, auto-generated files or secret keys
  • n+1 queries
  • flake8 issues
  • print
  • typos
  • unwanted comments

This PR contains valid:

  • tests
  • permission checks (tests here too)
  • translations

@sauravsapkota sauravsapkota force-pushed the feature/add-mutation-for-analysis branch from bbcda71 to 12ce2e0 Compare July 24, 2024 09:55
@sauravsapkota sauravsapkota changed the title WIP: Convert REST API for Analysis creation to GraphQL mutation WIP: Convert REST API for Analysis CRUD to GraphQL mutation Jul 24, 2024
apps/analysis/mutation.py Outdated Show resolved Hide resolved
apps/analysis/mutation.py Outdated Show resolved Hide resolved
@sauravsapkota sauravsapkota force-pushed the feature/add-mutation-for-analysis branch 2 times, most recently from 752e009 to b3ea86f Compare July 25, 2024 06:34
@sauravsapkota sauravsapkota changed the title WIP: Convert REST API for Analysis CRUD to GraphQL mutation Convert REST API for Analysis CRUD to GraphQL mutation Jul 25, 2024
@sauravsapkota sauravsapkota marked this pull request as ready for review July 25, 2024 12:04
@sauravsapkota sauravsapkota changed the title Convert REST API for Analysis CRUD to GraphQL mutation Analysis Module: Implement Analysis Mutation to setup a new analysis Jul 26, 2024
apps/analysis/mutation.py Outdated Show resolved Hide resolved
apps/analysis/mutation.py Outdated Show resolved Hide resolved
apps/analysis/mutation.py Outdated Show resolved Hide resolved
Copy link
Member

@susilnem susilnem left a comment

Choose a reason for hiding this comment

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

Let's verify.

apps/analysis/mutation.py Show resolved Hide resolved
apps/analysis/mutation.py Outdated Show resolved Hide resolved
apps/analysis/serializers.py Show resolved Hide resolved
@sauravsapkota sauravsapkota force-pushed the feature/add-mutation-for-analysis branch from db630f4 to d68451c Compare July 29, 2024 11:46
@sauravsapkota sauravsapkota changed the title Analysis Module: Implement Analysis Mutation to setup a new analysis WIP: Analysis Module: Implement Analysis Mutation to setup a new analysis Jul 30, 2024
@sauravsapkota sauravsapkota force-pushed the feature/add-mutation-for-analysis branch from d68451c to b505c2c Compare July 30, 2024 06:46
@sauravsapkota sauravsapkota changed the title WIP: Analysis Module: Implement Analysis Mutation to setup a new analysis Analysis Module: Implement Analysis Mutation to setup a new analysis Jul 30, 2024
@sauravsapkota sauravsapkota force-pushed the feature/add-mutation-for-analysis branch from b505c2c to 2f66047 Compare July 30, 2024 11:53
apps/analysis/serializers.py Outdated Show resolved Hide resolved
apps/analysis/serializers.py Outdated Show resolved Hide resolved
startDate: Date
endDate: Date!
clonedFrom: ID
analysisPillar: [AnalysisPillarGqlInputType!]
Copy link
Member

Choose a reason for hiding this comment

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

@subinasr @AdityaKhatri @sudan45 @sauravsapkota

Looking at this behavior, should we continue with this or modify the logic?

Basically, right now, while editing Analysis, one can remove one or multiple Analysis Pillar with one click.
Let discuss more on this.

Copy link
Member

Choose a reason for hiding this comment

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

@thenav56, I think this is fine for now. I'll create an issue to handle this behavior in the frontend.
the-deep/client#2981

Let me know what you think.

Copy link
Contributor Author

@sauravsapkota sauravsapkota Aug 6, 2024

Choose a reason for hiding this comment

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

projectId=self.project_without_af.id,
)

self.force_login(self.non_member_user)
Copy link
Member

Choose a reason for hiding this comment

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

We need to use member_user?

apps/analysis/tests/test_mutations.py Outdated Show resolved Hide resolved
@sauravsapkota sauravsapkota force-pushed the feature/add-mutation-for-analysis branch from 2f66047 to 682f97e Compare July 31, 2024 08:03
Copy link
Member

@thenav56 thenav56 left a comment

Choose a reason for hiding this comment

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

Almost done

apps/analysis/tests/test_mutations.py Show resolved Hide resolved
Comment on lines 1418 to 1429
self.assertEqual(
content['data']['project']['analysisCreate']['result']['title'],
minput['analysisData']['title']
)
self.assertEqual(
content['data']['project']['analysisCreate']['result']['teamLead']['id'],
str(self.member_user.id)
)
self.assertEqual(
content['data']['project']['analysisCreate']['result']['endDate'],
str(minput['analysisData']['endDate'])
)
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
self.assertEqual(
content['data']['project']['analysisCreate']['result']['title'],
minput['analysisData']['title']
)
self.assertEqual(
content['data']['project']['analysisCreate']['result']['teamLead']['id'],
str(self.member_user.id)
)
self.assertEqual(
content['data']['project']['analysisCreate']['result']['endDate'],
str(minput['analysisData']['endDate'])
)
analysis_resp_data = content['data']['project']['analysisCreate']['result']
self.assertEqual(analysis_resp_data['title'], minput['analysisData']['title'])
self.assertEqual(analysis_resp_data['teamLead']['id'], str(self.member_user.id))
self.assertEqual(analysis_resp_data['endDate'], str(minput['analysisData']['endDate']))

Comment on lines 1443 to 1452
minput = dict(
analysisData=dict(
title='Test Analysis', teamLead=self.member_user.id, endDate='2020-01-01'
),
projectId=self.project_with_af.id,
)

self.force_login(self.member_user)
content = self.query_check(self.CREATE_MUTATION, variables=minput)
self.assertIsNotNone(content['data']['project']['analysisCreate']['result']['id'])
Copy link
Member

Choose a reason for hiding this comment

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

Let's just use factory here.

Comment on lines 1492 to 1501
minput = dict(
analysisData=dict(
title='Test Analysis', teamLead=self.member_user.id, endDate='2020-01-01'
),
projectId=self.project_with_af.id,
)

self.force_login(self.member_user)
content = self.query_check(self.CREATE_MUTATION, variables=minput)
self.assertIsNotNone(content['data']['project']['analysisCreate']['result']['id'])
Copy link
Member

Choose a reason for hiding this comment

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

Let's just use factory here.

Copy link
Member

@susilnem susilnem left a comment

Choose a reason for hiding this comment

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

Minor changes

apps/analysis/tests/test_mutations.py Show resolved Hide resolved
apps/analysis/tests/test_mutations.py Outdated Show resolved Hide resolved
@sauravsapkota sauravsapkota force-pushed the feature/add-mutation-for-analysis branch 2 times, most recently from 05d71a4 to cf8a770 Compare August 16, 2024 11:22
apps/analysis/serializers.py Outdated Show resolved Hide resolved
apps/analysis/serializers.py Show resolved Hide resolved
@thenav56 thenav56 force-pushed the feature/add-mutation-for-analysis branch from cf8a770 to 56f7199 Compare August 22, 2024 05:13
@sudan45 sudan45 force-pushed the feature/add-mutation-for-analysis branch from 56f7199 to 9ec96c9 Compare October 1, 2024 09:21
@AdityaKhatri AdityaKhatri force-pushed the feature/add-mutation-for-analysis branch from 9ec96c9 to 355a5f5 Compare October 16, 2024 09:45
@sudan45 sudan45 force-pushed the feature/add-mutation-for-analysis branch 2 times, most recently from e8a506e to 49a7bc8 Compare October 18, 2024 09:15
@AdityaKhatri AdityaKhatri force-pushed the feature/add-mutation-for-analysis branch from cb86e92 to a5f03bb Compare November 7, 2024 04:12
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.

7 participants