Commit 856de6f0 authored by Boris Kocherov's avatar Boris Kocherov Committed by Boris Kocherov

erp5_officejs: fixed error: replication (appresources) is with looses if...

erp5_officejs: fixed error: replication (appresources) is with looses if previous replication was interrupted.
parent f7973779
...@@ -332,24 +332,12 @@ ...@@ -332,24 +332,12 @@
}) })
.push(function () { .push(function () {
if (('serviceWorker' in navigator) && (NAME !== "web page")) { if (('serviceWorker' in navigator) && (NAME !== "web page")) {
return jIO.createJIO(get_jio_cache_storage(NAME)).allDocs({ return gadget.getSetting('jio_' + NAME + '_modification_date')
query: '', .push(function (modification_date) {
sort_on: [
['modification_date', 'descending']
],
limit: [0, 1],
select_list: ['modification_date']
})
.push(function (data) {
var modification_date,
jio_store;
if (data.data.total_rows === 1) {
modification_date = data.data.rows[0].value.modification_date;
}
jio_store = get_jio_replicate_storage(NAME);
return gadget.getSetting('jio_' + NAME + '_cache_description') return gadget.getSetting('jio_' + NAME + '_cache_description')
.push(function (query) { .push(function (query) {
if (jio_store.__storage._query_options.query === query) { var jio_store = get_jio_replicate_storage(NAME);
if (jio_store.__storage._query_options.query === query && modification_date) {
return get_jio_replicate_storage(NAME, modification_date).repair(); return get_jio_replicate_storage(NAME, modification_date).repair();
} else { } else {
return gadget.setSetting( return gadget.setSetting(
...@@ -372,6 +360,20 @@ ...@@ -372,6 +360,20 @@
} }
}) })
.push(function () { .push(function () {
jIO.createJIO(get_jio_cache_storage(NAME)).allDocs({
query: '',
sort_on: [
['modification_date', 'descending']
],
limit: [0, 1],
select_list: ['modification_date']
})
.push(function (data) {
if (data.data.total_rows === 1) {
return gadget.setSetting('jio_' + NAME + '_modification_date',
data.data.rows[0].value.modification_date);
}
});
navigator.serviceWorker.register('gadget_officejs_' + NAME + '_serviceworker.js') navigator.serviceWorker.register('gadget_officejs_' + NAME + '_serviceworker.js')
.then(function (reg) { .then(function (reg) {
// registration worked // registration worked
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.57717.26579.17015</string> </value> <value> <string>954.57915.45763.26146</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1477585369.16</float> <float>1477598529.41</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment