carolinaknoll / awesome-gamified

:eyeglasses: Awesome Gamified - See your progress and save awesome links you've already seen!
https://carolinaknoll.github.io/awesome-gamified/
MIT License
73 stars 20 forks source link

[READMEs/Axios requests] Refactor and allow requests for differently cased README files #14

Closed carolinaknoll closed 4 years ago

carolinaknoll commented 4 years ago

Currently, the project only supports README files which are named like this README.md or like this readme.md. You are able to confirm this by reading this piece of code.

However, there are two main problems with the way the code is currently written.

  1. There are many cases when this request isn't being made correctly. For example, when I choose Front-end Development, and then CSS Frameworks inside it, it tries to get https://raw.githubusercontent.com/troxler/awesome-css-frameworks/master/README.md. It can't, so it throws an error. The expected should be for it to retry with a request for https://raw.githubusercontent.com/troxler/awesome-css-frameworks/master/readme.md, which should finally show the README content, but it doesn't.
  2. We cannot know the way every user will name their readme file. Naming it with uppercased README and lowercased extension (README.md) is the most common, but there are other ways (like readme.MD, readme.md, README.MD, etc). Is there a way to be able to try searching from the most common naming (README.md), to maybe the second common (readme.md), and then the other cases, without making the code too ugly? It would be awesome if we could not care for naming conventions at all, but I don't know if it is possible.

This issue can be used to create multiple pull requests. For example, one for the first point, and one for the second.

If you would like to work on it, please comment if you would like to explore only one of the points, or both. You can create two pull requests if you decide to work on both points.

Thank you!

katherine95 commented 4 years ago

I would like to work on this issue @carolinaknoll

carolinaknoll commented 4 years ago

That is fantastic, @katherine95! πŸ˜„

I have assigned you and labeled this issue as taken. πŸš€

Please let me know if you need any help in the future.

Thank you for taking your time to contribute to the project!

katherine95 commented 4 years ago

@carolinaknoll I worked on both and I would like to test the logic. Been trying to trace where the function is called but I can't find. Do we have a backend repo for this codebase? We can as well sync on this.

carolinaknoll commented 4 years ago

Hello @katherine95 I am sorry I couldn't understand you correctly, but you can check for the README url here. We don't have a backend repo for this, it is only this unique repository.

If you are already testing it, I understand that there are many different READMEs and that it would be tricky to manually find an URL with uppercased/lowercased/etc README names to test if everything is happening correctly. I think that as there are many, just test with a number of randomly-selected lists, and see if they are uppercased/lowercased/etc. You don't need to test all cases if you don't have the time for it, but the functionality needs to remain the same.

Thank you!

katherine95 commented 4 years ago

Hello @carolinaknoll. I managed to find out how to test it. With my implementation, I used a Github API which automatically returns a readme URL as part of the response. It doesn't matter the case of the README file. I have created a PR for it and it's ready for your review.

carolinaknoll commented 4 years ago

Thank you! πŸ˜„

As I wrote in more detail in the pull request, it is a great idea!

I have approved and merged your PR, so this issue will be closed for now.

Thank you for your contribution! πŸ˜„