← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8870: mobile: delete old values before storing new ones

 

------------------------------------------------------------
revno: 8870
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-11-05 11:48:22 +0100
message:
  mobile: delete old values before storing new ones
modified:
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js	2012-11-05 10:43:15 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js	2012-11-05 10:48:22 +0000
@@ -131,6 +131,9 @@
     return dhis2.storage.makeUploadDataValueSetRequest( dataValueSet ).error(function() {
         // add to local dataValueSets
         dataValueSets[dhis2.storage.getUniqueKey(dataValueSet)] = dataValueSet;
+
+        // delete old values
+        delete localStorage['dataValueSets'];
         localStorage['dataValueSets'] = JSON.stringify( dataValueSets );
     });
 };
@@ -147,6 +150,8 @@
     });
 
     return $.when.apply( null, deferreds ).always(function() {
+        // delete old values
+        delete localStorage['dataValueSets'];
         localStorage['dataValueSets'] = JSON.stringify( dataValueSets );
     });
 };