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

project page update dynamically with github api #187

Closed
wants to merge 10 commits into from

Conversation

hexwhiz
Copy link
Contributor

@hexwhiz hexwhiz commented Oct 22, 2024

Description

Added more fields (mentor, mentor url, description) in project schema in database. So, whenever admin hit the populate_project endpoint, details of any new project in the env file will get fetched from github using github API and will be populated in the database. The project homepage now updates dynamically based on the projects names present in the environment variables.

Related Issue

Fixes #177

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Motivation and Context

This change was necessary because on addition of new projects the project page was not updated automatically.

How Has This Been Tested?

I had to remove the admin status check from the populate_project view to hit the populate_project endpoint. But that change has been reversed in this PR. I had 4 projects in env file and then hit the endpoint which populated the data of projects in database. Then refreshing the project page shows the project details present in the database. The moviescreen project have no description on github that's why it shows None.

Screenshots (if appropriate):

image
image

Checklist:

  • I have registered myself at Contrihub website.
  • My code follows the code style of this project.
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • Any dependent changes have been merged and published in downstream modules
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

@meisabhishekpatel
Copy link
Contributor

@hexwhiz why are you adding ENV variable like CONTRIHUB_MENTOR etc in this is there a specific need, then tell why ? Can you please do it without changing the ENV

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 22, 2024

@meisabhishekpatel This variable is for the mentor of contrihub-24 repo. You told me to get the name of mentor of contrihub-24 from env. If env shouldn't be changed then I would just have to hardcode the mentor in the views.py file. Or I could keep the variables in settings.py and remove them from env.

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 23, 2024

@meisabhishekpatel should I make the changes then?

@meisabhishekpatel
Copy link
Contributor

@hexwhiz no changes I'll properly review the PR then tell you

@meisabhishekpatel
Copy link
Contributor

@hexwhiz can you update the sample env for the changes you have done

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 23, 2024

Okay i will

@meisabhishekpatel
Copy link
Contributor

@hexwhiz doesn't seem to be working can you check.

@meisabhishekpatel
Copy link
Contributor

@hexwhiz can you explain how are you update the projects on the page, like suppose I have few projects already in my env and i want to add let say 2 more projects , how will I add that

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 23, 2024

Add projects to AVAILABLE_PROJECTS env variable. Then hit the /populate_project endpoint. This will load the project details in database. Then opening the project page will show the projects.

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 23, 2024

For new projects just add there name in the env variable
AVAILABLE_PROJECTS='<old projects> , <new projects seperated by comma>

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 23, 2024

Done updating the sample env

@meisabhishekpatel
Copy link
Contributor

@hexwhiz tell me will clicking on populate project endpoint will it update the description or mentor, if it's already present in the db or not, if not then please make it like populate issues end points like it updates all the active issues in the db.

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 24, 2024

Oh! you are right. That populate_project view was set to skip the projects those were already present in database. I can just remove that check and it would then update all the projects in database when you hit populate_project. Would it be ok?

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 24, 2024

@meisabhishekpatel do you want the projects to be updated when you hit /populate_projects or /populate_issues?

@meisabhishekpatel
Copy link
Contributor

i want to update all the pre - existing project such that let say I changed description of my repo in github it should be updated when I hit populate_project button, and add the projects which are not already present in the db

do you want the projects to be updated when you hit /populate_projects or /populate_issues?

/populate_projects

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 25, 2024

Ok I have that ready I will commit after a few minutes

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 25, 2024

@meisabhishekpatel done making changes. One more thing, when I was testing the project, I hit the Github API limit. So I had to use API_TOKEN from github. I have updated the sample_env.txt for the same. Now this /populate_project endpoint updates the details of already added projects and remove any project that is in the database but not in the .env file.

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 27, 2024

@meisabhishekpatel any update?

@meisabhishekpatel
Copy link
Contributor

@hexwhiz can you just remove API_TOKEN thing you must have reached api limit due to numerous testing

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 27, 2024

Ok i will remove that

@meisabhishekpatel
Copy link
Contributor

@hexwhiz just make it like populate issues, see how populate issues is implemented.

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 28, 2024

@meisabhishekpatel done making changes. Sorry for these many commits, the build test was failing a lot😥

@meisabhishekpatel
Copy link
Contributor

@hexwhiz will review it soon

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 30, 2024

@meisabhishekpatel would you please review this? ContriHUB is ending😅

@meisabhishekpatel
Copy link
Contributor

@hexwhiz even if pending review will be happening even after contrihub ends and you will be awarded points

@meisabhishekpatel
Copy link
Contributor

@hexwhiz I have some doubts about it so not merging this PR but it is indeed acceptable to I'll give you points and add a hacktoberfest-accepted label so that it gets counted in hacktoberfest

@hexwhiz
Copy link
Contributor Author

hexwhiz commented Oct 31, 2024

Ok thanks. I am open for feedback if I did something wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fetch Project Details Dynamically from GitHub API
2 participants