changeset 23:fe334d22286a

button for updating a subset of cals
author drewp@bigasterisk.com
date Sat, 31 Jul 2021 15:05:23 -0700
parents 8122ff3b0fe5
children ecebc78b0a40
files gcalendarwatch.py index.html
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gcalendarwatch.py	Sat Jul 31 14:59:25 2021 -0700
+++ b/gcalendarwatch.py	Sat Jul 31 15:05:23 2021 -0700
@@ -312,8 +312,10 @@
 class PollNow(cyclone.web.RequestHandler):
 
     def post(self):
-        cal = json.loads(self.request.body).get('cal', None) if self.request.body else None
-        n = self.settings.poller.updateNow(cal)
+        cals = json.loads(self.request.body).get('cals', None) if self.request.body else None
+        n = 0
+        for cal in cals:
+            n += self.settings.poller.updateNow(cal)
         msg = f"found {n} new records"
         log.info(msg)
         self.write(msg.encode('utf8'))
--- a/index.html	Sat Jul 31 14:59:25 2021 -0700
+++ b/index.html	Sat Jul 31 15:05:23 2021 -0700
@@ -11,7 +11,7 @@
 	<p>MSG</p>
 
 	<button data-bind="click: pollNow">poll now</button>
-	<button data-bind="click: poll1Now">poll just ps4online cal now</button>
+	<button data-bind="click: poll1Now">poll just ps4Online and vrOnline cal now</button>
 <pre  id="results">
 </pre>
 	<script type="text/javascript" src="https://bigasterisk.com/lib/jquery-2.0.3.min.js"></script>
@@ -28,7 +28,12 @@
 	},
 	poll1Now: function() {
 		document.querySelector("#results").innerText += "poll...\n"
-		$.post("pollNow", JSON.stringify({cal: "iem9ppgqdbleh96nkeaj4l6714@group.calendar.google.com"}),
+		$.post("pollNow", JSON.stringify({
+			cals: [
+				"iem9ppgqdbleh96nkeaj4l6714@group.calendar.google.com",
+				"i08lv6mki8a23lloc139il5oh8@group.calendar.google.com",
+		]
+		}),
 		 function (res) {
 			document.querySelector("#results").innerText += res + "\ndone.\n"
 		});