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

Fix assets submission count missing with 'view_submissions' of project views #4225

Merged

Conversation

noliveleger
Copy link
Contributor

@noliveleger noliveleger commented Jan 20, 2023

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Make sure that your code lints and that you've followed our coding style
  5. Write a description of your work suitable for publishing on our forum

Description

Returns the correct number instead of 0

Related issue

Close #4194

Additional info

asset.has_perm(user, permission) returns True if user belongs to a project view that has permission selected for asset. Previous behaviour was False.

change_metadata permission has been rename change_metadata_asset to be consistent with other permissions.

and rename 'change_metadata' to 'change_metadata_asset' for consistency with DRF
@noliveleger noliveleger force-pushed the fix-submission-counts-with-view-submissions branch from cdcc23b to 3bf29be Compare January 21, 2023 03:53
@noliveleger noliveleger force-pushed the fix-submission-counts-with-view-submissions branch from 46eeff7 to dc61565 Compare January 23, 2023 19:09
@noliveleger noliveleger requested a review from jnm January 23, 2023 19:56
Copy link
Member

@jnm jnm left a comment

Choose a reason for hiding this comment

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

@noliveleger good to go after adding the test we discussed!

kpi/permissions.py Show resolved Hide resolved
@noliveleger noliveleger force-pushed the fix-submission-counts-with-view-submissions branch from ff12597 to 3a3f134 Compare January 24, 2023 19:09
Comment on lines 577 to 582
assert self._sorted_dict(asset_data['summary']) == self._sorted_dict(
asset_data['summary']
)
assert self._sorted_dict(asset_data['content']) == self._sorted_dict(
asset_data['content']
)
Copy link
Member

Choose a reason for hiding this comment

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

@noliveleger these are like assert x == x are they not? 🧐 Reformatted:

assert self._sorted_dict(asset_data['summary'])
    == self._sorted_dict(asset_data['summary'])

assert self._sorted_dict(asset_data['content'])
    == self._sorted_dict(asset_data['content'])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops :-P Indeed. Not what I wanted to do.
That's how you make tests pass no matter what :-P

@jnm jnm merged commit deb09b9 into feature/regional_projects Jan 25, 2023
@jnm jnm deleted the fix-submission-counts-with-view-submissions branch January 25, 2023 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Changes related to API endpoints Back end blocked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revisit and refactor permission checks for ProjectView django app
4 participants