davidsansome / tsurukame

Tsurukame is an unofficial WaniKani app for iOS. It helps you learn Japanese Kanji.
https://tsurukame.app
Apache License 2.0
263 stars 62 forks source link

Ipad tsurukame not syncing to online wanikani #528

Closed japanmissionary closed 2 years ago

japanmissionary commented 2 years ago

Hi! I have been using tsurukame on both my ipad and iphone, but now it seems the hundreds of reviews I have done on my ipad is not syncing to my iphone or wanikani! How can I fix this?

UInt2048 commented 2 years ago

Have you tried using the TestFlight beta?

LennonR commented 2 years ago

I'm having the same issue. I just used the app on a plane while offline and when I re-connected to wifi, all 300 reviews I did on the plane did not sync to the website. However in the app the reviews are shown as done. I tried doing one more review just to see if that would kickstart the sync. The one review I did while connected to wifi immediately synced, but all 300 reviews I did while offline, still are not syncing. The whole reason I downloaded this app was for offline capability.

EDIT: To be clear, I've used this app for a long time and never had an issue with syncing until yesterday.
EDIT2: I'm using the iPhone app.

UInt2048 commented 2 years ago

@LennonR Are you using the App Store version or TestFlight? If the former, try the latter.

LennonR commented 2 years ago

@UInt2048 I'm using the App Store version but if I switch to the TestFlight version all of my unsynced reviews that I did will be gone. If the bug is fixed on the server or in an update to the app store app, I don't lose all my work.

UInt2048 commented 2 years ago

@davidsansome Any chance of pushing the latest commit to the App Store?

bhonbunnag commented 2 years ago

Also ran into this issue. I noticed that if I pull down on the top bar (triggering a refresh) it will sync a single review card. Seems like a very janky temporary solution would be to keep triggering the refresh until they have all been synced. Unfortunately not ideal for me with the 680 reviews I did offline on the plane.

tivervac commented 2 years ago

I have a 1000 unsynched airplane reviews here as well. I'm fine with trying the testflight beta if there's a guarantee that I won't lose the unsynced reviews

tivervac commented 2 years ago

@UInt2048 @davidsansome let me know if there's anything I can do to speed this along. Currently my progress, even new lessons, is bottlenecked by the giant offline queue

resoldren commented 2 years ago

I hit this issue on iPad, App Store version of the software, a while back. I found it faster to do the 1 by 1 syncing by going to the iPad app switcher and back, or to go to the Home Screen and back. Not ideal, and I only had 100 to sync, but it got them synced, and then it wasn't having the problem anymore once I caught up.

tivervac commented 2 years ago

Had a look around in the meantime. My idea was that I'd just make a script to upload all the reviews and lessons that got stuck. By now I expect 50 lessons and about 1500 reviews.

I exported the local database and imported into a sqlite visualizer, only to find out the database saves protobuff messages. Some more staring at the repository showed me I could run the Makefiles in the /proto and sqlite3-extension to then be able to use the proto() function in sqlite giving me items like

sqlite> SELECT proto("Progress",pb) FROM pending_progress LIMIT 1;
meaning_wrong: true
reading_wrong: false
is_lesson: false
assignment {
  id: 263645876
  level: 56
  subject_id: 8320
  subject_type: VOCABULARY
  available_at: 1638010800
  started_at: 1635364063
  srs_stage_number: 6
  passed_at: 1636097078
}
created_at: 1638654885
meaning_wrong_count: 1

The problem however is that I only see 371 items in the pending_progress table and 0 items in the pending_study_materials so either the app's export doesn't export everything, or some of my data was already lost, or I don't understand how the DB maps to wanikani data.

Nevertheless, having figured out how to export and read a DB, time to have a hand at writing an external upload script.

tivervac commented 2 years ago

It's not the prettiest code I've written, but here it is.

My biggest question here is how I can prevent WK from throwing 429 (too many requests) at me. Is there a way of bundling multiple reviews per request together? For now, I'll just leave it running overnight.

tivervac commented 2 years ago

Seems like I did indeed lose data, but at least the app is unstuck now, after the night of running my script

davidsansome commented 2 years ago

There's a new version (1.23) rolling out this week that should fix these sync issues!