On archived red_fams do not delete possibly existing ending
This commit is contained in:
35
red_fam.py
35
red_fam.py
@@ -162,9 +162,6 @@ class RED_FAM_PARSER( RED_FAM ):
|
||||
"""
|
||||
|
||||
self._ending = self.__datetime( ending )
|
||||
|
||||
self._status = 1 #__TODO__ STATUS NUMBER
|
||||
self._changed = True
|
||||
|
||||
def __datetime( self, timestamp ):
|
||||
"""
|
||||
@@ -194,26 +191,36 @@ class RED_FAM_PARSER( RED_FAM ):
|
||||
- 0 Discussion is running --> no ending, page is not an archive
|
||||
- 1 Discussion is over --> ending present, page is not an archive
|
||||
- 2 Discussion is archived --> ending (normaly) present, page is an archive
|
||||
- 3 and greater status was set by worker script, do not change it
|
||||
"""
|
||||
# Diskussion läuft --> Status ? --> 0 ! _ending
|
||||
# Diskussion beendet --> Status 0 --> 1 _ending
|
||||
# Diskussion archiviert --> Status 0/1 --> 2 ???
|
||||
|
||||
# No ending, discussion is running:
|
||||
# Sometimes archived discussions also have no detectable ending
|
||||
if not self._ending and not self._red_page_archive:
|
||||
self._status = 0
|
||||
else:
|
||||
if not self._red_page_archive:
|
||||
self._status = 1
|
||||
# Do not change stati set by worker script etc.
|
||||
if not self.__mysql.data['status'] > 2:
|
||||
|
||||
# No ending, discussion is running:
|
||||
# Sometimes archived discussions also have no detectable ending
|
||||
if not self._ending and not self._red_page_archive:
|
||||
self._status = 0
|
||||
else:
|
||||
self._status = 2
|
||||
if not self._red_page_archive:
|
||||
self._status = 1
|
||||
else:
|
||||
self._status = 2
|
||||
else:
|
||||
self._status = self.__mysql.data[ 'status' ]
|
||||
|
||||
|
||||
|
||||
def changed( self ):
|
||||
"""
|
||||
Checks wether anything has changed and maybe triggers db update
|
||||
"""
|
||||
|
||||
# On archived red_fams do not delete possibly existing ending
|
||||
if not self._ending and self._status > 1 and self.__mysql.data[ 'ending' ]:
|
||||
self._ending = self.__mysql.data[ 'ending' ]
|
||||
|
||||
|
||||
# Since status change means something has changed, update database
|
||||
if( self._status != self.__mysql.data[ 'status' ] or self._beginning != self.__mysql.data[ 'beginning' ] or self._ending != self.__mysql.data[ 'ending' ] or self._red_page_id != self.__mysql.data[ 'red_page_id' ] ):
|
||||
self.__mysql.update_fam( self._red_page_id, self._beginning, self._ending, self._status )
|
||||
|
||||
Reference in New Issue
Block a user