Skip to content

Commit

Permalink
Merge pull request #48 from andela-kanyanwu/42__help_text_in_menu_com…
Browse files Browse the repository at this point in the history
…mand_for_rating

42  help text in menu command for rating
  • Loading branch information
kosyfrances committed Jan 21, 2016
2 parents 70c3f61 + 84dd6fc commit ab37ee6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion plugins/food_bot_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_menu_template_context(buff):
if menu:
menu_dict = Helper.convert_menu_list_to_dict(menu)
return {'template': 'menu_response',
'context': {'menu': menu_dict}}
'context': {'menu': menu_dict, 'day': day}}

elif day in ['saturday', 'sunday']:
return {'template': 'weekend_meal_error', 'context': {}}
Expand Down
15 changes: 8 additions & 7 deletions templates/help_response.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
```Shows help menu: help
```SHOW HELP MENU: help

Get the menu for today: menu
GET THE MENU FOR TODAY: menu

Get the menu for any day: menu [DAY_OF_WEEK]
Example: menu tuesday
GET THE MENU FOR ANY DAY: menu [DAY_OF_WEEK]
EXAMPLE: menu tuesday

Rate today's meal: rate [meal] [option] [rating] [comment]
Example: rate breakfast 1 4 great meal I really enjoyed it
NOTE: [rating] is between 1 and 5 while [comment] is optional
RATE TODAY'S MEAL: rate [MEAL] [OPTION] [RATING] [COMMENT]
EXAMPLE: rate breakfast 1 4 great meal I really enjoyed it

NOTE: [RATING] is between 1 and 5 while [COMMENT] is optional
For meal option, send the command `menu` to get menu options
```
14 changes: 11 additions & 3 deletions templates/menu_response.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
Here is the menu.```
```
Here is the menu for ${day.title()}
----------------------------------------------------------
% for mealtime in sorted(menu.keys()):
${mealtime.title()}
${mealtime.upper()}
%for option in sorted(menu[mealtime].keys()):
option ${option} : ${menu[mealtime][option]}
OPTION ${option} : ${menu[mealtime][option]}
%endfor

% endfor

RATE TODAY'S MEAL: rate [MEAL] [OPTION] [RATING] [COMMENT]
EXAMPLE: rate breakfast 1 4 great meal I really enjoyed it

NOTE: [RATING] is between 1 and 5 while [COMMENT] is optional
Meal options are above
```
6 changes: 3 additions & 3 deletions tests/show_menu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_correct_template_name_and_context(self, *args):
weekend_response_dict2 = Helper.get_menu_template_context(['menu',
'SUNDAY'])
weekday_response_dict = Helper.get_menu_template_context(['menu',
'tuesday'])
'monday'])
menu_response_dict = Helper.get_menu_template_context(['menu'])

self.assertEqual(invalid_day_response_dict,
Expand All @@ -72,9 +72,9 @@ def test_correct_template_name_and_context(self, *args):
self.assertEqual(weekend_response_dict2,
{'template': 'weekend_meal_error', 'context': {}})
self.assertEqual(weekday_response_dict, {'template': 'menu_response',
'context': {'menu': 'menu list as dict'}})
'context': {'menu': 'menu list as dict', 'day': 'monday'}})
self.assertEqual(menu_response_dict, {'template': 'menu_response',
'context': {'menu': 'menu list as dict'}})
'context': {'menu': 'menu list as dict', 'day': 'monday'}})

CustomSQL.query.assert_called_with(
'SELECT food, meal, option FROM menu_table WHERE day = (%s) AND week = (%s)',('monday', '1'))

0 comments on commit ab37ee6

Please sign in to comment.