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 @@
})
.push(function () {
if (('serviceWorker' in navigator) && (NAME !== "web page")) {
return jIO.createJIO(get_jio_cache_storage(NAME)).allDocs({
query: '',
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 + '_modification_date')
.push(function (modification_date) {
return gadget.getSetting('jio_' + NAME + '_cache_description')
.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();
} else {
return gadget.setSetting(
......@@ -372,6 +360,20 @@
}
})
.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')
.then(function (reg) {
// registration worked
......@@ -393,4 +395,4 @@
});
});
}(window, rJS));
\ No newline at end of file
}(window, rJS));
......@@ -224,7 +224,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.57717.26579.17015</string> </value>
<value> <string>954.57915.45763.26146</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -242,7 +242,7 @@
</tuple>
<state>
<tuple>
<float>1477585369.16</float>
<float>1477598529.41</float>
<string>UTC</string>
</tuple>
</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