Kaniwani / kw-backend

Server, Database, and Backend functionality for KaniWani
https://kaniwani.com
72 stars 11 forks source link

Potential Bug: Sync/Level Up #100

Closed DJTB closed 8 years ago

DJTB commented 8 years ago

From https://www.wanikani.com/chat/api-and-third-party-apps/11872/page/4#post281810

Little bug: I leveled up 3 hours ago, however it still says that I am level 6. I tried restarting my internet browser, but it did not change anything.

Anyway, thanks for this website, the new design is very nice! Post not responded to

tadgh commented 8 years ago

@Duncan How do you feel about making this a more voluntary thing. Like whenever the user hits the home page, we sync their profile. I was originally batching it to reduce load on WK servers, but I don't know if that makes sense anymore.

DJTB commented 8 years ago

We could add a button on homepage to resync with WK. That way we can give visual feedback and user knows they might have to wait briefly. So.. "Refresh reviews, Resync with WK, and the review count/link button"

tadgh commented 8 years ago

Actually how about this. If he hits the homepage, we sync him. However we cap sync to once every 30 min. I would rather have less "clickables" because it will lead people to potentially blow their API limits

DJTB commented 8 years ago

Makes sense to me. Do we need visual feedback that it's syncing - or is it entirely on the backend. User hits home page, it starts syncing with WK but they try to navigate to reviews - what happens? Is it blocked with an overlay/animation "syncing" and they have to wait, or does it go to reviews anyway?

I think making them wait like the WK "考えてる" animation - something that overlays the homescreen transparently - and is removed when sync finishes (via ajax.done() response).

tadgh commented 8 years ago

I'll leave you in charge of the UI decisions. I can make it block or non-block. I would lean towards non-blocking. Since the sync I'm thinking of is mostly for profile stuff, and also whatever "new" vocab theyve just unlocked.

DJTB commented 8 years ago

Let's go with the simple solution - set it up to happen in the background when homepage is hit, once every 30min (or whatever you settle on).If they start reviews then they start with their current (read: previous) review queue - and probably by the time they finish they'll have new vocab/level synced across and can do another review then anyway.

Are there any potential problems with reviews getting recorded while that sync is happening though?

tadgh commented 8 years ago

Not possible that it would cause issues with sync. Once the reviews page is loaded, the reviews are set. Even if it syncs some new stuff, it would just show up immediately in the next review. It's safe imo.

DJTB commented 8 years ago

Can this be closed via 24b5070?

tadgh commented 8 years ago

Yes indeed