]> rtime.felk.cvut.cz Git - coffee/coffee-flask.git/log
coffee/coffee-flask.git
5 years agoEnglish fixes
Michal Sojka [Wed, 27 Feb 2019 13:56:01 +0000 (14:56 +0100)]
English fixes

5 years agoMake config-related error message more informative
Michal Sojka [Wed, 27 Feb 2019 13:55:38 +0000 (14:55 +0100)]
Make config-related error message more informative

Without this information, it's hard to figure out why things do not work.

5 years agoAdd last coffee pack button
Jiri Vlasak [Tue, 12 Feb 2019 13:15:35 +0000 (14:15 +0100)]
Add last coffee pack button

When clicked, the message notifying Tonda about the lack of coffee is
sent to the Slack.

There must be `.config` file in `coffee-flask` folder. The `.config`
file is JSON formated. For this patch the following is needed:
```
{
        "coffeebot": {
                "url": "https://hooks.slack.com/services/..."
        }
}
```

5 years agoFix data acquisition for flavor graph.
Jaroslav Klapalek [Wed, 14 Nov 2018 07:49:50 +0000 (08:49 +0100)]
Fix data acquisition for flavor graph.

Function 'coffee_flavors' wasn't doing what it was supposed to do.
Upper bound was shifted by a day (so for a week graph it was count-
ing 8 days) and also it didn't take into account 'start' variable.

5 years agoAdd TODO
Michal Sojka [Fri, 12 Oct 2018 07:13:43 +0000 (09:13 +0200)]
Add TODO

5 years agoAdd graphs with total coffee consumption on login screen
Jaroslav Klapalek [Thu, 11 Oct 2018 11:42:38 +0000 (13:42 +0200)]
Add graphs with total coffee consumption on login screen

5 years agoFix tag in 'user' template
Jaroslav Klapalek [Thu, 11 Oct 2018 11:43:40 +0000 (13:43 +0200)]
Fix tag in 'user' template

5 years agoRemove unused function
Jaroslav Klapalek [Fri, 14 Sep 2018 09:39:54 +0000 (11:39 +0200)]
Remove unused function

5 years agoFix incorrect counting of coffees made during time close to midnight
Jaroslav Klapalek [Fri, 14 Sep 2018 09:39:53 +0000 (11:39 +0200)]
Fix incorrect counting of coffees made during time close to midnight

Datetime in database is stored in UTC timezone. Currently we are in
UTC +2 timezone (GMT +1). Because of time shifts fixing the time
cannot be done in a static way.

Dynamic solution is using paramater 'localtime' in SQL query function
date(). Therefore it is required for the target device to have
properly set timezone.

TODO:
Suggested solution is to use 'type converters' for python/sqlite3.

5 years agoFix coffee graph for start of the month
Jaroslav Klapalek [Mon, 3 Sep 2018 16:03:43 +0000 (18:03 +0200)]
Fix coffee graph for start of the month

An error was found during the start of new month. To fix this I have
changed the SQL query to use '%s' (unix time) instead of '%d' (day
number).

How does this work?
The SQL query is using relation between two tables based on the date.
This relation is created using these parts of query:
 > "select num,date('now',-num || ' days')" as d from days
 > d = date(c.time)

First line creates timestampes of last 7 days -- time is set to
UTC midnight.
Second line converts data in 'c.time' to date struct - BUT! Even
here the time is set to midnight. This behaviour makes the relation
possible.

How does it behave in app.py?
Result of the query contains data that are ordered by time.
Unfortunately this order is lost during recasting the data to
list/dict (which are unordered). To solve this sorting is used.
Sorting data with unix time is safe, because it is always increasing.

To highlight this change, 'days' variable is refactored to 'unix_days'.

5 years agoCenter all content
Michal Sojka [Thu, 16 Aug 2018 21:56:54 +0000 (23:56 +0200)]
Center all content

It looks less ugly.

5 years agoShow current content of the offline queue when going offline
Michal [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
Show current content of the offline queue when going offline

5 years agoDo not allow multiple reconnect timers running simultaneously
Michal [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
Do not allow multiple reconnect timers running simultaneously

It is unnecessary waste of resources.

5 years agoWhen replaying offline queue, use the original event time rather than now()
Michal [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
When replaying offline queue, use the original event time rather than now()

This way, coffees will be logged with correct time independently of
online/offline mode.

5 years agoRemove unused variable
Michal [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
Remove unused variable

5 years agoReplace "fuck" with "ajax_failure"
Michal [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
Replace "fuck" with "ajax_failure"

It makes the reason of the data structure clearer :-)

5 years agoLogout automatically even without selecting any beverage
Michal [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
Logout automatically even without selecting any beverage

When a user logs in, and no beverage is selected within 120 seconds,
she are logged out automatically.

The main purpose for this functionality that when somebody swipes a
card in the offline mode and than goes away, because she does not see
nice graph. When the server is online again, the offline-collected
data is replayed and the user would stay logged in forever.

5 years agoImplement clean switching between online and offline mode
Michal Sojka [Thu, 16 Aug 2018 17:58:58 +0000 (19:58 +0200)]
Implement clean switching between online and offline mode

Now it is simple. When we are online, #remote div is shown and #local
is hidden, when offline, it is the opposite.

5 years agoCatch all exceptions in JS function updateUI
Michal [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
Catch all exceptions in JS function updateUI

It fails when offline data is processed. It is important that offline
data are processed entirely and only once. If the code crashes in the
middle, due to an exception, the same offline queue will be replayed
next time, causing some coffees to be accounted multiple times and
some maybe never accounted.

5 years agoUse new data structure for offline-collected data
Michal [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
Use new data structure for offline-collected data

The data is now stored in an array. For details, see commit
985405cd4345315d0502fe9e75ef879ad0c452b3 in mt-apps repository.

5 years agoRemove commented out code
Michal [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
Remove commented out code

5 years agoImprove log messages
Michal Sojka [Thu, 16 Aug 2018 13:41:09 +0000 (15:41 +0200)]
Improve log messages

5 years agoReplace loggedIn with id_user
Michal Sojka [Thu, 16 Aug 2018 09:51:43 +0000 (11:51 +0200)]
Replace loggedIn with id_user

Now, when we have the id_user variable, the value loggedIn is not
needed anymore, because its value corresponds to whether the id_user
is set or not.

5 years agoImprove the last commit
Michal Sojka [Thu, 16 Aug 2018 09:46:55 +0000 (11:46 +0200)]
Improve the last commit

- Move id_user variable to where other variables are defined and
  document it.
- Set its value in the login() function. All other activities related
  to logging in are in that function, so I don't see a reason, why
  this should be outside.
- Unset this variable in addCoffee() and logout(). We should not need
  it after these events.

5 years agoSave id user local for add coffee
Tomas Prochazka [Wed, 15 Aug 2018 12:45:18 +0000 (14:45 +0200)]
Save id user local for add coffee

Related to commit 0a3365605be571d23e78b9cc14b014aeee8ec15d

5 years agoUse button element instead of input
Michal Sojka [Wed, 15 Aug 2018 10:14:06 +0000 (12:14 +0200)]
Use button element instead of input

It seems that the web browser on the terminal does not understand '\n' in
value attribute so I hope that it will understand '<br>' in button's
content.

5 years agoWhen the server goes offline, try to teload the page automatically
Michal Sojka [Tue, 14 Aug 2018 23:04:27 +0000 (01:04 +0200)]
When the server goes offline, try to teload the page automatically

5 years agoFix the data log in offline server mode
Tomas Prochazka [Tue, 14 Aug 2018 20:11:38 +0000 (22:11 +0200)]
Fix the data log in offline server mode

Retrieve data JSON in the correct order.
JSON are sorted by the key (date), when they were stored.

5 years agoAttempt to sanitize the JS code + fix few bugs
Michal Sojka [Tue, 14 Aug 2018 22:38:17 +0000 (00:38 +0200)]
Attempt to sanitize the JS code + fix few bugs

The problems solved by this commit:

- When another user logs in during logout timeout, he was logged out
  automatically, even before choosing a coffee.

- Logout timer was not shown always when it should. After choosing a
  coffee, the timer was shown for a while. Then, after the user page
  was reloaded from the server, the timer disappeared and after an
  elapsed second, the timer was shown again.

- Local debug area was not shown and hidden consistently.

The first problem was resolved by canceling the logout timer after
login. The last two problems were fixed by centralizing of the UI
updates to a single function, which does the update based on the value
of state variables.

5 years agoRemove unnecessary condition
Michal Sojka [Tue, 14 Aug 2018 21:54:01 +0000 (23:54 +0200)]
Remove unnecessary condition

The same condition is already in addCoffee()

5 years agoSimplify timer-triggered logout call
Michal Sojka [Tue, 14 Aug 2018 21:28:34 +0000 (23:28 +0200)]
Simplify timer-triggered logout call

5 years agoUnify logout button spelling and layout
Michal Sojka [Tue, 14 Aug 2018 21:25:04 +0000 (23:25 +0200)]
Unify logout button spelling and layout

Changes:

- Logout button text is always in small caps (both initial value from
  HTML and modified value from JavaScript).
- Position of the "logout" text is always the same - when we add a
  line with seconds counter below, we have to add also a line above.

5 years agoAdd function automatic logout
Tomas Prochazka [Tue, 14 Aug 2018 07:47:57 +0000 (09:47 +0200)]
Add function automatic logout

If the user makes a coffee, the user will logout automatically in 10 second.

5 years agoDo not show zeros in the taste graph
Michal Sojka [Fri, 10 Aug 2018 11:56:56 +0000 (13:56 +0200)]
Do not show zeros in the taste graph

5 years agoReformat
Michal Sojka [Fri, 10 Aug 2018 11:50:13 +0000 (13:50 +0200)]
Reformat

5 years agoShowing the total number different coffee flavor in chart
Tomas Prochazka [Fri, 10 Aug 2018 11:40:29 +0000 (13:40 +0200)]
Showing the total number different coffee flavor in chart

5 years agoFix axis-Y only integer numbers show
Tomas Prochazka [Fri, 10 Aug 2018 10:35:48 +0000 (12:35 +0200)]
Fix axis-Y only integer numbers show

5 years agoReformat with autopep8
Michal Sojka [Fri, 10 Aug 2018 09:04:21 +0000 (11:04 +0200)]
Reformat with autopep8

5 years agoFix color graph history for different flavors coffee
Tomas Prochazka [Fri, 10 Aug 2018 07:02:37 +0000 (09:02 +0200)]
Fix color graph history for different flavors coffee

5 years agoPlot x axis labels in local variable
Jiri Hubacek [Fri, 10 Aug 2018 08:58:56 +0000 (08:58 +0000)]
Plot x axis labels in local variable

5 years agoIncrease the size of the logout button
Jiri Hubacek [Thu, 9 Aug 2018 14:09:51 +0000 (14:09 +0000)]
Increase the size of the logout button

5 years agoUse day abbreviations instead of numbers for days
Jiri Hubacek [Thu, 9 Aug 2018 13:26:20 +0000 (13:26 +0000)]
Use day abbreviations instead of numbers for days

The originally meant x axis description may be accomplished by using

    plt.xticks(range(len(days)), days)

instead of

    plt.xticks(range(len(days)), xdays)

5 years agoMake on-screen buttons work only once after card swipe
Michal Sojka [Wed, 8 Aug 2018 11:36:32 +0000 (13:36 +0200)]
Make on-screen buttons work only once after card swipe

Now, even if a user does not log out, there is no way for somebody
else to charge coffees on their behalf.

5 years agoBetter guidance for users
Michal Sojka [Wed, 8 Aug 2018 07:58:39 +0000 (09:58 +0200)]
Better guidance for users

5 years agoDeploy without pushing to central server
Michal Sojka [Wed, 8 Aug 2018 11:11:59 +0000 (13:11 +0200)]
Deploy without pushing to central server

This makes testing easier.

5 years agoShow public address of git repository
Michal Sojka [Wed, 8 Aug 2018 07:47:08 +0000 (09:47 +0200)]
Show public address of git repository

5 years agoUpdate 'Hack me' section
Michal Sojka [Tue, 7 Aug 2018 13:27:50 +0000 (15:27 +0200)]
Update 'Hack me' section

5 years agoAdd Makefile with deploy target
Michal Sojka [Tue, 7 Aug 2018 13:26:18 +0000 (15:26 +0200)]
Add Makefile with deploy target

5 years agoUpdate html
Michal Sojka [Tue, 7 Aug 2018 13:23:52 +0000 (15:23 +0200)]
Update html

5 years agoMake figures fit on screen
Michal Sojka [Tue, 7 Aug 2018 13:23:30 +0000 (15:23 +0200)]
Make figures fit on screen

5 years agoUpdate web pages a bit
Michal Sojka [Tue, 7 Aug 2018 13:07:11 +0000 (15:07 +0200)]
Update web pages a bit

5 years agoOlder sqlite complains about 'true' in expressions - don't use it
Michal Sojka [Tue, 7 Aug 2018 13:05:24 +0000 (15:05 +0200)]
Older sqlite complains about 'true' in expressions - don't use it

5 years agoFix type errors when drawing bar graph
Michal Sojka [Tue, 7 Aug 2018 13:03:09 +0000 (15:03 +0200)]
Fix type errors when drawing bar graph

DB returns strings as day numbers, but matplotlib seems to want integers.

5 years agoMake un run under WSGI
Michal Sojka [Tue, 7 Aug 2018 11:17:51 +0000 (13:17 +0200)]
Make un run under WSGI

5 years agoclean slate
Jiří Matěják [Thu, 24 May 2018 22:59:17 +0000 (00:59 +0200)]
clean slate