[MOBILE-2127] Support database syncing and offline Created: 29/May/17  Updated: 28/Jul/17  Resolved: 28/Jul/17

Status: Closed
Project: Moodle app
Component/s: Database add-on
Affects Version/s: 3.3.0
Fix Version/s: 3.3.1

Type: New Feature Priority: Minor
Reporter: Pau Ferrer Assignee: Pau Ferrer
Resolution: Fixed Votes: 0
Labels: triaged
Remaining Estimate: 0 minutes
Time Spent: Not Specified
Original Estimate: 2 weeks, 5 hours

Issue Links:
is blocked by MOBILE-2122 Support database comments Closed
Peer reviewer: Daniel Palou
Integrator: Juan Leyva
Testing Instructions:
  1. Navigate to a database activity.
  2. Add a new entry in offline mode.
  3. Approve or dissaprove an entry in offline mode.
  4. Edit an already created entry in offline mode.
  5. Delete an already created entry in offline mode.
  6. Go online and sync.
  7. Check changes have been uploaded.
Affected Branches: MOODLE_33_STABLE
Fixed Branches: MOODLE_33_STABLE
Epic Link: Database Mobile App
Pull Master Diff URL: https://github.com/moodlehq/moodlemobile2/compare/integration...crazyserver:MOBILE-2127
Fix Release Date: 28/Jul/17
Component watchers:
Sprint: Moodle Mobile 3.3.1


Support database syncing and offline for:

  1. Add entry
  2. Update entry
  3. Approve entry
  4. Delete entry

Comment by Daniel Palou [ 19/Jul/17 ]

Thanks Pau,

this was a huge patch. Here are the things I noticed (minor things):

  1. Wrong JSDoc in here. The same in deleteEntry.
  2. You shouldn't delete the siteId in this JSDoc. Also, the indentation is weird.
  3. I think this comment is wrong.
  4. I'm not sure if it's still there, but Windows XP had a restriction on the path length (I think it was 255 characters). So trying to work with files whose path was longer than 255 always returned an error. Now that we have a Windows desktop app we should be careful with this, so maybe we should remove the "entry_" part of the path in here.
  5. Wrong JSDoc in here.
  6. In here, you shouldn't do the WS call if you already have courseId. The same happens in delete entry.
  7. This should be showErrorModalDefault. The same happens in delete entry.
  8. All the functions "overrideData" have a wrong JSDoc that says it belongs to $mmaModDataFieldsDelegate.
  9. This variable isn't camelCase.
  10. You lack a space in here and in here.
  11. The function checkFields has no JSDoc.
  12. Typo.
  13. This $q.when isn't needed.
  14. Typo.
  15. Wrong JSDoc in here.
  16. I think this condition will never be true.
  17. This comment says "feedback".
  18. In the synchronization, you're deleting the actions that have a timemodified lower than the one you retrieve from Moodle. I think that, if ANY of the offline actions were performed before the online timemodified, you should discard ALL the actions for that entry (even if some of the actions were performed after the one in Moodle). This is because the user performed those actions without synchronizing (otherwise there would be no entries with lower timemodified), so he performed the changes over invalid data.
  19. There is a bug in this case. You aren't returning anything and there is no "break", so the code will call deleteEntry.



Comment by Pau Ferrer [ 20/Jul/17 ]

Thanks Dani, all solved! Yours again

Comment by Daniel Palou [ 20/Jul/17 ]

Thanks Pau, it looks good now, sending to integration!

Comment by Juan Leyva [ 20/Jul/17 ]

Thanks Pau, everything looks good.

Changes integrated!

Comment by Juan Leyva [ 20/Jul/17 ]

Skipping testing for now, the complete module will be tested once the last issue in the epic (refurbish) is integrated.

Generated at Tue Feb 19 16:11:59 UTC 2019 using Jira 7.12.0#712001-sha1:ad166f5f9410495f8c71bd6c53abc939fb5afea7.