Changeset - 8d221d669ea8
[Not reviewed]
default
0 2 0
Dennis Fink - 9 years ago 2016-03-18 00:55:47
dennis.fink@c3l.lu
Fix people_now_present
2 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
setup.py
Show inline comments
 
@@ -9,7 +9,7 @@ packages.append('spaceapi.schema')
 

	
 
setup(
 
    name='c3l_spaceapi',
 
    version='0.0.4',
 
    version='0.0.5',
 
    url=None,
 
    license='GPLv3+',
 
    author='Dennis Fink',
spaceapi/utils.py
Show inline comments
 
@@ -55,9 +55,9 @@ class ActiveStatus(Singleton, dict):
 
    def add_user_present(self, username):
 
        if self['state']['open']:
 
            if 'people_now_present' not in self['sensors']:
 
                self['sensors']['people_now_present'] = {'value': 0}
 
                self['sensors']['people_now_present'] = [{'value': 0}]
 

	
 
            people_now_present = self['sensors']['people_now_present']
 
            people_now_present = self['sensors']['people_now_present'][0]
 

	
 
            if 'names' in people_now_present and username not in people_now_present['names']:
 
                people_now_present['value'] += 1
 
@@ -71,13 +71,13 @@ class ActiveStatus(Singleton, dict):
 
                if username in current_app.config['PEOPLE_NOW_PRESENT_ALLOWED']:
 
                    people_now_present['names'] = [username]
 

	
 
            self['sensors']['people_now_present'] = people_now_present
 
            self['sensors']['people_now_present'][0] = people_now_present
 
        else:
 
            pass
 

	
 
    def remove_user_present(self, username):
 
        if self['state']['open'] and 'people_now_present' in self['sensors']:
 
            people_now_present = self['sensors']['people_now_present']
 
            people_now_present = self['sensors']['people_now_present'][0]
 

	
 
            if people_now_present['value'] > 0:
 
                people_now_present['value'] -= 1
 
@@ -89,7 +89,7 @@ class ActiveStatus(Singleton, dict):
 
                    people_now_present['names'].remove(username)
 
                    if not people_now_present['names']:
 
                        del people_now_present['names']
 
            self['sensors']['people_now_present'] = people_now_present
 
            self['sensors']['people_now_present'][0] = people_now_present
 
        else:
 
            pass
 

	
0 comments (0 inline, 0 general)