mstenta / farm_sync

Drupal 8 module with features for synchronizing records from farmOS into the local database.
1 stars 0 forks source link

Handle paging of records #2

Closed mstenta closed 5 years ago

mstenta commented 5 years ago

Currently, this module only pulls the first page of records over the REST API. It's possible to pull more pages manually using the page filter, but that is not currently done in the getRecords() method.

mstenta commented 5 years ago

I refactored some of the methods in the farmOS class:

https://github.com/mstenta/farm_sync/commit/1c81fc68b18191a393bf7394c319532d1fe15488 https://github.com/mstenta/farm_sync/commit/e9f5f208df74dda0e85256c351ddde6859a0216b https://github.com/mstenta/farm_sync/commit/f40964aac5662b6b22908e2fd0c0cb64fcaae5c0

That allowed me to add a new pageCount() method for determining how many pages of records exist for a given entity type and filters.

https://github.com/mstenta/farm_sync/commit/c270e0c0b44cb155597a5929e626f0c1bb0af94b

The next step is to refactor the sync form so that it performs the sync as a batch operation, and runs once for each page of records.

mstenta commented 5 years ago

Done: https://github.com/mstenta/farm_sync/commit/12eda695bd5caee49c4d2b2d9f33320bcedf9b27