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

Jkmarx/fix transfer ownership bug #3055

Merged
merged 2 commits into from Oct 12, 2018
Merged

Conversation

jkmarx
Copy link
Member

@jkmarx jkmarx commented Oct 11, 2018

@@ -364,10 +367,36 @@ class SharableResource(OwnableResource):
def __unicode__(self):
return self.name

def get_owner(self):
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved from the data_set class. Fritz noted this method improved performance 10%-20% percent.

@codecov
Copy link

codecov bot commented Oct 11, 2018

Codecov Report

Merging #3055 into develop will decrease coverage by 0.88%.
The diff coverage is 97.59%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3055      +/-   ##
===========================================
- Coverage    60.66%   59.78%   -0.89%     
===========================================
  Files          434      434              
  Lines        27871    27111     -760     
  Branches      1275     1275              
===========================================
- Hits         16908    16208     -700     
+ Misses       10963    10903      -60
Impacted Files Coverage Δ
refinery/core/test_models.py 99.84% <100%> (+0.06%) ⬆️
refinery/core/models.py 75.72% <88.23%> (-3.82%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c6d703f...32a49aa. Read the comment docs.

pass

return owner

Copy link
Member

Choose a reason for hiding this comment

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

Feel free to ignore, since this is just a move, but:

  • There is an exists(), but I'd be surprised if it's much of an improvement over count().
  • Maybe just return in the try? (and get rid of owner = None and return owner)
  • I can see that it's tested below, but I can't remember what it would mean to be ownerless, and how that would be useful.

def test_set_owner_data_sets_read_meta_perms(self):
self.data_set.set_owner(self.user)
user_perms = get_perms(self.user, self.data_set)
self.assertTrue('read_meta_dataset' in user_perms)
Copy link
Member

Choose a reason for hiding this comment

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

I might have done all of these at once with issubset, but this works, too.

@jkmarx jkmarx merged commit 406e63a into develop Oct 12, 2018
@jkmarx jkmarx deleted the jkmarx/fix-transfer-ownership-bug branch October 12, 2018 17:39
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.

None yet

3 participants