-
Notifications
You must be signed in to change notification settings - Fork 328
fixed cafe bug #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fixed cafe bug #26
Conversation
cafe.rb
Outdated
| @@ -1,4 +1,5 @@ | |||
| # frozen_string_literal: true | |||
| # require 'debug' | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
提出物からはコメントアウトでなくて消しましょう
cafe.rb
Outdated
| ].freeze | ||
|
|
||
| def take_order(menus) | ||
| # binding.break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上です。提出物からは消しましょう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました。
cafe.rb
Outdated
| order2 = take_order(FOODS) | ||
|
|
||
| total = FOODS[order1][:price] + DRINKS[order2][:price] | ||
| total = FOODS[order2][:price].to_i + DRINKS[order1][:price].to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これでOKです。しかし本質的にはorder1,2のようなわかりにくい命名が引き起こしがちな不具合ともいえます。したがってよりよい解答としては変数名の見直しまでするといいですね。修正は任意で結構です。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました!今のコードはorder1はdrinkorderになって、食べ物の分はfoodorderになりました。
|
|
||
| puts 'bugカフェへようこそ!ご注文は? 番号でどうぞ' | ||
| order1 = take_order(DRINKS) | ||
| drinkorder = take_order(DRINKS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
細かいことをいうとスネークケースで書いたほうがいいのでdrink_orderが適切ですね
|
|
||
| puts 'フードメニューはいかがですか?' | ||
| order2 = take_order(FOODS) | ||
| foodorder = take_order(FOODS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上です。
No description provided.