-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
Show author changes in exercise objects #1052
Show author changes in exercise objects #1052
Conversation
Looks good! This was easier than what I had thought, I will try to take a closer look later today or so. I'm not sure whether we need to expose the complete history: if you change the description twice your name will appear twice and while we need to keep this data internally, it's not so useful for consumers over the api. |
Yeah I can see the advantage of having just the distinct authors and then potentially add new endpoints to fetch indepth information about an exercise history. Another improvment to the MR would be to have these authors on all exercise API endpoints that it would make sense on. I guess that would be any already with the original license author on it. |
I'm also thinking we could move |
Yeah sure. Will be easier to maintain. I'll close this off and go with that approach. |
You don't need to close this or, Just push your changes |
0fb8c94
to
83efe84
Compare
Hey, would this be more suitable. |
wouldn't the new LicenseAuthorHistory more or less duplicate some of the logic that the history plugin already does? What I meant with a class was to write a simple mixin that we could then just plug in in all the models that have a history. class HistoryMixin():
@property
def author_history(self):
...
return {}
class Exercise(AbstractLicenseModel, models.Model, HistoryMixin):
.... |
I should also finally fix the tests in the crowdsourcing branch, it's really annoying having constantly red checks! |
Oh yeah I'll look at that approach 👍. |
83efe84
to
21e062f
Compare
I think it's ready again for an initial review before proceeding :). |
wger/utils/models.py
Outdated
@property | ||
def author_history(self): | ||
out = [] | ||
for history in self.history.all(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make the list unique? Perhaps casting it to a set is enough, we don't care about the order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sure. I'll continue expanding out using this as a base.
Hey man, Is there anything else you would like from this change? or if I even did the change you wanted correctly. |
Hi! I just haven't found any time, but this looks ready :) |
Yeah all good :) |
Proposed Changes
Please check that the PR fulfills these requirements
Other questions
Showcase
Exercise object no changes
Add to license history table
Exercise now shows
python manage.py change-author --author-name Tom --exercise-id 1
python manage.py change-author --author-name James --exercise-id 1