If you open in offline a database that hasn't been opened before, the logView function is called without a databaseid. This data is stored in a local DB, so the app will call the WS to view a database without the ID, so the WS fails. The app should delete the log if the WS returns an error, but it doesn't so the call is retried every certain time.
How to reproduce:
- Add a new site in the app and open a course.
- Go offline.
- Open a database. You should see an error saying you aren't connected.
- Leave the database and go online. The app should now start doing requests to log database without sending an ID.
We need to fix 2 things in this issue:
- In database index, it calls logView if this.data exists, but this.data is initialized to an empty object so it always exists.
- Logs should be deleted if the WS call fails.