From 416e091f2487aab69f49f32386515491ba3156d2 Mon Sep 17 00:00:00 2001 From: Simon Pamies Date: Tue, 21 Jun 2011 02:45:14 +0200 Subject: [PATCH] Fixed sorting for last races, fixed leaderboard empty values, added new icons for gains and losses --- .../sailing/connector/provider.py | 6 ++- .../sailing.web/sailing/web/browser/core.py | 9 ++-- .../sailing/web/browser/functions.py | 39 ++++++++++++------ .../web/browser/moderator-static/app.js | 8 +--- .../browser/moderator-static/arrow-gain.png | Bin 201 -> 172 bytes .../browser/moderator-static/arrow-loss.png | Bin 205 -> 177 bytes .../web/browser/moderator-static/flags/de.png | Bin 2831 -> 398 bytes .../web/browser/templates/java-connector.pt | 3 +- .../web/browser/templates/leaderboard-live.pt | 10 ++--- 9 files changed, 44 insertions(+), 31 deletions(-) diff --git a/python/src/sailing.connector/sailing/connector/provider.py b/python/src/sailing.connector/sailing/connector/provider.py index d70bcc63ed8..0ea8fe7f4c4 100644 --- a/python/src/sailing.connector/sailing/connector/provider.py +++ b/python/src/sailing.connector/sailing/connector/provider.py @@ -43,7 +43,9 @@ class LiveDataReceiver(threading.Thread): # make it possible to pause listener if self.paused is True: - time.sleep(1) + print >>sys.stderr, '#', + sys.stderr.flush() + time.sleep(5) continue conf = URIConfigurator(self.host, self.port) @@ -62,7 +64,7 @@ class LiveDataReceiver(threading.Thread): else: conf.setParameters(dict(eventname=self.eventname, racename=self.racename, sinceupdate=self.updatecount)) - conf.setLogging(True) + conf.setLogging(False) try: # need to lock because other threads could overwrite information diff --git a/python/src/sailing.web/sailing/web/browser/core.py b/python/src/sailing.web/sailing/web/browser/core.py index c7a9c92e46e..c52c8098205 100644 --- a/python/src/sailing.web/sailing/web/browser/core.py +++ b/python/src/sailing.web/sailing/web/browser/core.py @@ -231,13 +231,16 @@ class BaseView(object): if name[0] == 'ETASEC': val = '%.f:%d' % (int(value) / 60, int(value)-( (int(value)/60)*60 )) if len(val.split(':')[-1]) == 1: - val = '%s0' % val + val = '0%s' % val + + if val == '00:0': + val = '0:0' if name[0] == 'GLP': if value > 0: - val = '%s' % value + val = '%s' % value elif value < 0: - val = '%s' % abs(value) + val = '%s' % abs(value) else: val = '0' return val diff --git a/python/src/sailing.web/sailing/web/browser/functions.py b/python/src/sailing.web/sailing/web/browser/functions.py index e9d1aae7d56..a2bef900c98 100644 --- a/python/src/sailing.web/sailing/web/browser/functions.py +++ b/python/src/sailing.web/sailing/web/browser/functions.py @@ -180,6 +180,12 @@ def configureListener(context, request): view.session['listener-started'] = True view.session.save() + elif request.POST.get('emergency-reload', None): + state = reloadData(context, request) + if state is True: + return view.yieldMessage('Data refreshed! Can take a while until listener threads recover. Make sure to also reload running Leaderboards!') + return view.yieldMessage('Could not refresh data - this should NEVER happen :-)') + elif request.POST.get('disconnect-server', None): # disconnect does not stop listeners but just disconnects the # session of the user from server @@ -696,21 +702,28 @@ def reloadData(context, request): # drops all data in database and reload all running listeners view = core.BaseView(context, request) - event = view.currentEvent() - if event: + # pause all listener threads + for listener in threaded_listener.values(): + if listener.paused == False: + listener.paused = True - # pause all listener threads - for listener in threaded_listener.values(): - if listener.paused == False: - listener.paused = True + # give threads time to pause + time.sleep(10) - # remove competitors matching the event - model.CompetitorImpl.removeAllBy(event=event.name) + # drop DB with all data in it + from sailing.db.monitoring import dropDB + dropDB() - # reload event data completely - configurator = view.listenerConf() - configurator.setContext(config.MODERATOR) - configurator.setCommand(config.LIST_EVENTS) - provider.eventConfiguration(configurator) + # reload event data completely + configurator = view.listenerConf() + configurator.setContext(config.MODERATOR) + configurator.setCommand(config.LIST_EVENTS) + provider.eventConfiguration(configurator) + # start threads again + for listener in threaded_listener.values(): + if listener.paused == True: + listener.paused = False + + return True diff --git a/python/src/sailing.web/sailing/web/browser/moderator-static/app.js b/python/src/sailing.web/sailing/web/browser/moderator-static/app.js index 19750ad02ac..dea442714c9 100644 --- a/python/src/sailing.web/sailing/web/browser/moderator-static/app.js +++ b/python/src/sailing.web/sailing/web/browser/moderator-static/app.js @@ -108,14 +108,13 @@ function sortBy(param, element) { } function yieldValue(element, newvalue, ignore_zeros, alternate_value) { - if (element.html() != newvalue) { if (ignore_zeros == true && (newvalue == '0' || newvalue == 0)) { // show alternate value if (alternate_value != undefined && alternate_value != '' && alternate_value != 'None') { element.html(alternate_value); } else { - element.html(' '); + element.html('—'); } return; } @@ -132,11 +131,6 @@ function yieldValue(element, newvalue, ignore_zeros, alternate_value) { else element.html(newvalue); - } else { - if (alternate_value != undefined && alternate_value != '' && alternate_value != 'None') { - element.html(alternate_value); - } - } } /** diff --git a/python/src/sailing.web/sailing/web/browser/moderator-static/arrow-gain.png b/python/src/sailing.web/sailing/web/browser/moderator-static/arrow-gain.png index fe9bcff7da37d8b83756fb6497a5acc14e755f72..1d0d57157aaeb2c0493da25f2598ae68002a4681 100644 GIT binary patch delta 141 zcmX@fxQ0=&Gr-TCmrII^fq{Y7)59eQNOOWP2OE%lFp*7QqM}B!pQnpsNX4zBU;qEx zGb^4s;=qzHXHQti0;Q74E{zqMQ;x0TP}wNnv3S82ja^DJm|`{LUEViorW{(tz{azH qt93?!hC|qn>74ycJDeIAm>HUKR2`laJuv~=z~JfX=d#Wzp$P!904?zV delta 171 zcmZ3(c#=`EGr-TCmrII^fq{Y7)59eQNDF{42OE%-|NK93qM}B9wx^3@NX4zBKmY&R zGpjam&VMqc^pJYv4-Pxio*gj^S1JTOUOMg+FKW6cC6vk#pe#LM7uON3jI4adjd~Xr z#JB9(Ali|-q2n~;N420m4SI>3TmG_mHg@oA$W%MYuxU}@m4<~$49ZJyN-7*+(0{BR V5nt4>31~for>mdKI;RB2CIC8HJ@5bk diff --git a/python/src/sailing.web/sailing/web/browser/moderator-static/arrow-loss.png b/python/src/sailing.web/sailing/web/browser/moderator-static/arrow-loss.png index aba1e973718147103720dbe4585c234e885717a1..c76f0deef0430204b399335ddf784dba3ab86c9a 100644 GIT binary patch delta 146 zcmX@hxRFt@Gr-TCmrII^fq{Y7)59eQNOOWP2OE%lFp*7QqM}Adu&0Y-NX4zBJ!(3C z<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IpUgC$DV|v~ zbI`-cL*P;6(LW2Hl`w1HtbR{JPl0E(=OZs;FOgTR*RZ#xcdGYc?-xGyK60PqKI1$$ z-ZI`wBrnsy*W_HW0Wrec-#cqqYFCLW#$!oKa ztOZ#u3bsO~=u}!L*D43HXJuDrzs-rtIhL!QE6wf9v&!3$H=OUE|LqdO65*1zrG`sa zEge|qy{u|EvOIBl+X~|q1uKSD2CO`|inc0k)laMKSC_7Sy(W51Yk^+D%7VeQ0c-0E zRSM;Wee2xU?Ojh;FInHUVfu!h8$K0@imnvf7nc=(*eKk1(e4|2y!JHg)!SRV_x(P}zS~s+RZZ1q)n)rh`?L2yu8FGY z_?G)^U9C=SaqY(g(gXbmBM!FLxzyDi(mhmCkJc;eM-ImyzW$x>cP$Mz4ONYt#^NJz zM0w=t_X*$k9t}F$c8q(h;Rn+nb{%IOFKR-X@|s4QQ=0o*Vq3aT%s$c9>fU<%N829{ zoHRUHc}nwC$!Xf@g42^{^3RN&m7RTlF8SPG+oHC6=VQ*_Y7cMkx)5~X(nbG^=R3SR z&Rp`ibn>#>OB6F(@)2{oV%K?xm;_x?s~noduI3P8=g1L-SoYA z@fQEq)t)&$-M#aAZ}-Lb_1_lVesU-M&da;mcPH+xyidGe^g!)F*+boj)jwPQ+}Q8j ze`>&Yp!3n(NB0JWgU|kv^^Xrj1&^7J%Z3ex>z+71IXU7#a{cN2r$f(V&nBK1{-XZN zt``^}my^G3e5L*B!0Q>W+s4Ai9=^$VGcjKDR{QP2cieX!@1x%j zPvm?ce<=TG`LXp=(5L&88IzO$1Ou4!{O>iCf&c&j32;bRa{vGf6951U69E94oEQKA z00(qQO+^RW1`-J>FA5gs1^@s6T}ebiR4C7#k+BiPKnwzxJ6ZYnU)!f2zZ(z^JT3qe zk?cr-_TIKh)ZJx!W+Ke?;+5)stopping listener it will trigger two methods: If you select a race
Handling   -     +     +    
diff --git a/python/src/sailing.web/sailing/web/browser/templates/leaderboard-live.pt b/python/src/sailing.web/sailing/web/browser/templates/leaderboard-live.pt index d3ffcd85d4d..6e301c2b380 100644 --- a/python/src/sailing.web/sailing/web/browser/templates/leaderboard-live.pt +++ b/python/src/sailing.web/sailing/web/browser/templates/leaderboard-live.pt @@ -73,7 +73,7 @@ -
+
@@ -117,7 +117,7 @@ ${racebundles[int(request.params.get('r', 0))].index(bundle)+1+(int(request.params.get('r', 0))*3)} - +
@@ -148,7 +148,7 @@ - + @@ -172,7 +172,7 @@ M${markid-1} F - +