[web2py] Re: How to catch index error

2019-03-21 Thread Dave S
On Tuesday, March 19, 2019 at 5:45:42 PM UTC-7, Leonel Câmara wrote: > > Notice that, it seems you are using [-1] because > I thought he was doing that to test our ability to count brackets, braces, and parens. (GG's default font, as used on my screen, makes them very close in appearance; us

Re: [web2py] Re: How to catch index error

2019-03-19 Thread Maurice Waka
This works well Boss!! Thanks a lot and God Bless! Regards On Wed, Mar 20, 2019 at 3:45 AM Leonel Câmara wrote: > Notice that, it seems you are using [-1] because want to get the last > record where the user was awake/light sleep/sleep, however you don't use an > order by, so depending on the st

[web2py] Re: How to catch index error

2019-03-19 Thread Leonel Câmara
Notice that, it seems you are using [-1] because want to get the last record where the user was awake/light sleep/sleep, however you don't use an order by, so depending on the strategy the database decides to use, there's no guarantee that it will be the last. This is also inefficient because yo

[web2py] Re: How to catch index error

2019-03-19 Thread Dave S
On Tuesday, March 19, 2019 at 11:57:35 AM UTC-7, Maurice Waka wrote: > > I have a code that works OK except when there is no data in the database. > > [...] > gauge.add('Awake', [{'value':[i.awake for i in data][-1], 'max_value': > 24}]) > gauge.add('Light Sleep', [{'value':[i.light_sl

[web2py] Re: How to catch index error

2019-03-19 Thread isi_jca
In this place def sleep_chart(): response.files.append(URL('e_default','static/js/pygal-tooltips.min.js')) response.headers['Content-Type']='image/svg+xml' custom_style = Style( background='transparent', plot_background='transparent', foreground='#53E89B',