ContriHUB / ContriHUB-24

ContriHub is an event under Avishkar-24 where we are expecting to get more and more people involved in Open Source activities.
https://sac.mnnit.ac.in/contrihub
MIT License
4 stars 24 forks source link

Update the status of existing issues on contrihub-21 site when populating issues. #151

Closed ankitsangwan1999 closed 3 years ago

ankitsangwan1999 commented 3 years ago

During Poupulating issues i.e. populate_issues function in project/views.py file, new issues are added to the DB for contrihub-21 website from Github and already existing issues are kept as it is.

So, During Populating Issues, if an existing issue is closed on GitHub and Open on contrihub-21 website, update its status in DB as closed.

dhanrajchaurasia commented 3 years ago

Sir do I have to add a label named status as there is no such label present in the database for an issue? or do I have to update is_restricted label?

ankitsangwan1999 commented 3 years ago

You have to update all the fields as per labels and state(open and close) you get from GitHub issue, for e.g. state (open/Close), mentor, is_restricted etc.

dhanrajchaurasia commented 3 years ago

Sir I tried to declare state = issue['state'] so it was returning 'open' and 'close' so tried to update the value as db_issues.state = state but an error was occurring stating that the expected integer found 'close' or 'open' so I gave them value as 1 and 0 accordingly using if/else cases so by doing I had to update those HTML's if/else conditions issue.state == 1 (former it was issue.OPEN) so after doing this those closed issues became vanished from the home screen and got appeared in profile page as status 'closed' in red button.

ankitsangwan1999 commented 3 years ago

Whatever Issue state you get from GitHub is correct and to be applied on contrihub-21 website. So, assign it accordingly i.e. either issue.OPEN or issue.CLOSED. Moreover, only open/currently assigned issues are shown on the homepage and not the closed ones. In the profile page, however, all issues are shown whose mentor is the current user.

dhanrajchaurasia commented 3 years ago

Yes Sir I was admin(locally) of the website as I had changed the permissions from Django admin panel so closed issues were showing there as I have assigned the issue as I am a mentor so it means closed issues would be shown to only mentors who made the issues, not to anyone else. So is it okay is?

dhanrajchaurasia commented 3 years ago

AttributeError at /project/populate_issues/ 'dict' object has no attribute 'OPEN' Sir this error is coming after assigning the values as issue.OPEN and issue.CLOSE

ankitsangwan1999 commented 3 years ago

You have to use Issue.CLOSED i.e. the property of Issue class, currently you are trying to access 'issue' which is just a dictionary returned from API call.