Conversation
ee7c643 to
909d75d
Compare
909d75d to
c1e6a38
Compare
| update.message.reply_text(add_favorite_already_exists_msg()) | ||
| return | ||
|
|
||
| update.message.reply_text(added_favorites_msg(favorites)) |
There was a problem hiding this comment.
Could we reduce verbosity with one-liner
update.message.reply_text(added_favorites_msg(favorites) if favorites is None else add_favorite_already_exists_msg())
| update.message.reply_text(no_favorites_msg()) | ||
| return | ||
|
|
||
| update.message.reply_text('Select your favorite food to remove:', reply_markup=favorites_kb(favorites)) |
There was a problem hiding this comment.
Abstract away the reply text to const.py or message.py?
| message_id=update.callback_query.message.message_id, reply_markup=favorites_kb(favorites)) | ||
| else: | ||
| context.bot.edit_message_text(text=favorites_msg(favorites), chat_id=update.effective_chat.id, | ||
| message_id=update.callback_query.message.message_id, reply_markup=favorites_kb(favorites)) |
There was a problem hiding this comment.
Same as above the one-liner?
| favorites = data[FAVORITES] | ||
|
|
||
| cursor.close() | ||
| return favorites # returns favorites in user_pref |
There was a problem hiding this comment.
Can we practice DRY by taking in the type of user_pref as a function parameter and extract data accordingly?
These few lines are almost exactly the same as line 65-79
| cursor = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor) | ||
| cursor.execute(settings_update(FAVORITES), (favorites, chat_id)) | ||
| conn.commit() | ||
| cursor.close() |
There was a problem hiding this comment.
Likewise, can we DRY the updating process?
| HOME = 'home' | ||
| HIDE_CUISINE = 'hidden' | ||
| ADD_FAVORITE = 'add_favorite' | ||
| REMOVE_FAVORITE = 'remove_favorite' |
There was a problem hiding this comment.
Should it be Singapore readable 'favourite' for the users or left Americanized?
TODO: