rosekamallove / youtemy

A great way to learn from YouTube courses without any distractions and the ability to enroll in courses and track them with a daily streak to become more consistent.
https://youtemy-bc22a.firebaseapp.com/
MIT License
39 stars 12 forks source link

Fixes #67: sync database with playlist on youtube #75

Closed tuanthanh2067 closed 2 years ago

tuanthanh2067 commented 2 years ago

Hello, I may need to perform some testing first but here's what I currently have. Please have a look at it and tell me what you think.

rosekamallove commented 2 years ago

Looks okay to me, does it work just fine?

P.S. Giving it a look at my local...

tuanthanh2067 commented 2 years ago

I'm trying to generate some dump data to test it out

rosekamallove commented 2 years ago

Great man!

rosekamallove commented 2 years ago

I just checked it doesn't seem to be working...

Youtube Playlist: image DB: image

tuanthanh2067 commented 2 years ago

Sure I'll have a look at it

tuanthanh2067 commented 2 years ago

Not sure why but it does work on my local. How did you test it?

rosekamallove commented 2 years ago

Lemme try again!

tuanthanh2067 commented 2 years ago

I tried Learn HTML5 and CSS3 From Scrat... course

  1. Delete some videos in database so the data being fetched from youtube has more videos (it's like creator has added some more videos to their playlist)
  2. Go to the course
  3. The database is updated and the dom as well
rosekamallove commented 2 years ago

Yeah, it is working now, I forgot to change the branch smh.

The API calls are heavy lol

rosekamallove commented 2 years ago

Do I merge it now or you wanna spend more time? Looks fine to me!

rosekamallove commented 2 years ago

Hey! a small little bug, it sets watched to false. You're calling handleAddCourse which doesn't care about the current state of the DB

tuanthanh2067 commented 2 years ago

Oh yes so I can not use the handleAddCourse function at all

rosekamallove commented 2 years ago

Yeah exactly

tuanthanh2067 commented 2 years ago

Ok let me do it again

rosekamallove commented 2 years ago

I think you can create a handleCourseUpdate and push the new videos

tuanthanh2067 commented 2 years ago

Yeah true

tuanthanh2067 commented 2 years ago

I'm not sure but you have any idea of concat a new array to an old array in firestore?

tuanthanh2067 commented 2 years ago

I just added update array in the firebase so that current data about videos are still intact

rosekamallove commented 2 years ago

Have you tested it?

tuanthanh2067 commented 2 years ago

Yeah I did

rosekamallove commented 2 years ago

I'll merge it then