Giter Club home page Giter Club logo

attendancebot's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

attendancebot's Issues

Clear attendance data automatically after three days.

Currently /event end does not clear attendance data, only closes the event manually. Events automatically expire in 3 days but do not clear attendance data either. So CR has to manually enter /event clear.

Add an expiry date to the cgs collection (used to store tally for CG) and tally collection (used to store tally for cluster and whole JC) as done for event collection. Code below:

manager.py

begins = datetime.today()
expires = daysFrom(begins, 3)
expires_string = expires.strftime('%c')
events.save( { 'name': name, 'start': begins, 'end': expires, 'done': False, 'tally': 0, } )

/event report returns NoneType error if no event exists in the database.

/event report

2017-02-05 01:44:18,802 : INFO     Received '/event report' from 'Justin' (87244565)
Traceback (most recent call last):
  File "/home/justin/.local/lib/python3.5/site-packages/telepot/delegate.py", line 256, in wait_loop
    j.on_message(msg)
  File "/home/justin/.local/lib/python3.5/site-packages/telepot/helper.py", line 630, in augmented
    return handler(msg)
  File "/home/justin/.local/lib/python3.5/site-packages/telepot/helper.py", line 996, in on_message
    self._router.route(msg)
  File "/home/justin/.local/lib/python3.5/site-packages/telepot/helper.py", line 972, in route
    return fn(msg, *args, **kwargs)
  File "/home/justin/.local/lib/python3.5/site-packages/telepot/helper.py", line 980, in <lambda>
    self._router = Router(flavor, {'chat': lambda msg: self.on_chat_message(msg),
  File "main.py", line 183, in on_chat_message
    reply(manager.printGrandTally())
  File "/home/justin/webprojects/AttendanceBot/manager.py", line 409, in printGrandTally
    total = getFinalString(tally.find_one( { } ))
  File "/home/justin/webprojects/AttendanceBot/manager.py", line 387, in getFinalString
    total = str(cgDoc['total'])
TypeError: 'NoneType' object is not subscriptable
2017-02-05 01:44:18,807 : ERROR    on_close() called due to TypeError: 'NoneType' object is not subscriptable

Add try-except block to handle error, and send user an appropriate message.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.