Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Improve source code and fix bugs
Browse files Browse the repository at this point in the history
[Improvement points]
-> Some conditional statements have been changed to ternary operators.

[Fixed bug]
-> The problem of printing the meal information after two days has been fixed.
  • Loading branch information
BackGwa committed Nov 5, 2022
1 parent 6898a84 commit c3596e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions johnson.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,15 @@ def meal_zone(JSON, usetime, meal_value):
mealzone = 'lunch'
elif(hour > 14):
mealzone = 'dinner'

elif(islc):
mealzone = 'lunch'

else:
mealzone = 'None'

if(usetime):
if(mealzone != 'None'):
result = [mealzone] + data['menu'][0][f'{mealzone}']
else:
result = ['급식 정보가 존재하지 않습니다.']
result = ([mealzone] + data['menu'][0][f'{mealzone}']) if (mealzone != 'None') else ['급식 정보가 존재하지 않습니다.']

elif((data['menu'][0][mealzone]) != []):
result = [mealzone] + data['menu'][0][f'{mealzone}']
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# 알레르기 정보 >> [표시] : True | [숨기기] : False
# 급식 시간대 >> [조식] : breakfast | [중식] : lunch | [석식] : dinner

date = [0, 0, 2] # 날짜추가 : 현재 날짜에서 추가하고 싶은 [년, 월, 일]
result = meal.now('high', 'N100000164', date, True, True) # meal.now(학교타입, 학교코드, 날짜추가, 알레르기 정보 표시, 자동 가져오기, 급식 시간대)
date = [0, 0, 0] # 날짜추가 : 현재 날짜에서 추가하고 싶은 [년, 월, 일]
result = meal.now('high', 'N100000164', date, False, True) # meal.now(학교타입, 학교코드, 날짜추가, 알레르기 정보 표시, 자동 가져오기, 급식 시간대)

for value in result:
print(value)

0 comments on commit c3596e1

Please sign in to comment.