diff options
author | Struan Donald <struan@exo.org.uk> | 2012-11-15 15:52:24 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-11-15 16:52:42 +0000 |
commit | c0decb7cebf1132c8a7445304d64bda6607b8132 (patch) | |
tree | a6a03c1884ae8540781ead3233e936484421c937 /www/js/mobile.js | |
parent | 3bdb4ec377a3a3938966d5ed053601c181d549df (diff) |
if we have a current report then update and save that rather than creating a new one
Diffstat (limited to 'www/js/mobile.js')
-rw-r--r-- | www/js/mobile.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/www/js/mobile.js b/www/js/mobile.js index f81acf5..9f27221 100644 --- a/www/js/mobile.js +++ b/www/js/mobile.js @@ -531,8 +531,17 @@ function get_report_params () { function _submit_save_report() { var params = get_report_params(); - var r = new Report(params); - r.save(); + var r; + if ( localStorage.currentReport ) { + r = new Report(); + r.load( localStorage.currentReport ); + r.update(params); + } else { + r = new Report(params); + } + if ( r.id() != -1 ) { + r.save(); + } return r; } |