engine/process.py
def question_insert(self, message):
        """Control the message length. Get the latest question
           for a survey. If None, save the question into the
           latest row for the survey. Return the proper answer"""
        if len(message.text) > 50:
            return answers['LONG']

        cursor.execute(f"select question from {self.db}questions where id = (select max(id) from {self.db}questions "
                       f"where survey = '{self.get_survey(message)}')")
        if cursor.fetchall()[0][0] is None:
            cursor.execute(f"update {self.db}questions set question = '{self.sub(message.text)}' "
                           f"where id = (select max(id) from {self.db}questions where "
                           f"survey = '{self.get_survey(message)}')")
            connection.commit()
            return answers['Q_SAVED'] % self.sub(message.text)
Control the message length. Get the latest question
           for a survey. If None, save the question into the
           latest row for the survey. Return the proper answer
Control the message length. Get the latest question
for a survey. If None, save the question into the
latest row for the survey. Return the proper answer
Control the message length . Get the latest question for a survey . If None save the question into the latest row for the survey . Return the proper answer
def question_insert(self, message):
        if len(message.text) > 50:
            return answers['LONG']
        cursor.execute(f"select question from {self.db}questions where id = (select max(id) from {self.db}questions "
                       f"where survey = '{self.get_survey(message)}')")
        if cursor.fetchall()[0][0] is None:
            cursor.execute(f"update {self.db}questions set question = '{self.sub(message.text)}' "
                           f"where id = (select max(id) from {self.db}questions where "
                           f"survey = '{self.get_survey(message)}')")
            connection.commit()
            return answers['Q_SAVED'] % self.sub(message.text)
def question_insert ( self , message ) : if len ( message . text ) > 50 : return answers [ 'LONG' ] cursor . execute ( f"select question from {self.db}questions where id = (select max(id) from {self.db}questions " f"where survey = '{self.get_survey(message)}')" ) if cursor . fetchall ( ) [ 0 ] [ 0 ] is None : cursor . execute ( f"update {self.db}questions set question = '{self.sub(message.text)}' " f"where id = (select max(id) from {self.db}questions where " f"survey = '{self.get_survey(message)}')" ) connection . commit ( ) return answers [ 'Q_SAVED' ] % self . sub ( message . text )
Control the message length.
Control the message length .
"""Control the message length. Get the latest question
           for a survey. If None, save the question into the
           latest row for the survey. Return the proper answer"""
self
message