Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[bug 1078233] Change Rep of the Month date #1444
Thanks, there are a few code things to improve and I also found an error. I've created an entry for March (2018-03-01) and then went back and changed it to 2018-04-15. While it got saved correctly, the entry on the Reps profile still shows "Featured Rep for March 2018" and doesn't reflect the new date.
This happens every time I edit it. I think if we allow it to have a date, we also should allow edits on it.
This is my recording that show that is working on my local system.
I saw the issue with None showed on new post. I think that we can hide the field on new submission and show only on editing is the best way also because we not publish rotm for different months all together.
You will also need to edit the models.py file  to add some logic in the save() method otherwise you won't be able to save the new date because it will be always overridden with now().
You could add something like:
if not self.pk and not self.created_on`
in this line .
Thanks for your efforts here, Daniele. I've made a few more comments. Will test once those are addressed.
For the front page I think it should never show up if the date is in the future. For the list, entries in the future should only be shown if the user has the "can_edit_featured" permission, the same as for the "Add new" button as seen here: https://github.com/mozilla/remo/blob/master/remo/featuredrep/templates/featuredrep_list.jinja#L26
I've added a few comments. Additionally here are some test cases:
- Log in as Council member, add new RoM for today
- Create a new RoM for next month
- Go to RoM overview and check that you can see both entries
- Go to the frontpage and check that you only see the one from today, not the one from next month
- Leave the form empty -> should display errors nicely
- Add date > 30 days in the future -> should shout at you in a nice red error box
- Log in as normal Rep, check that you can only see the one from today in the overview
- Check that you can only see the one from today on the frontpage
I'll need to test this again once you have fixed everything. There are two things I'd like you to fix, see above.