Skip to content
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

models.py and documents.py expand #56

Merged
merged 13 commits into from
Sep 8, 2023
2 changes: 1 addition & 1 deletion .gitignore
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原本是對的 這個要改回來
我是指不要刪掉 .env.example 這個檔案

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.idea/**
.env
.env.example
/Lib
/Scripts
/Include
Expand Down
12 changes: 0 additions & 12 deletions api/views/petViews.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊可以參考目前 Master branch 的寫法,先製作 Serializer(DTO 的概念),就不需要自行定義輸入資料

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這些 low moderate high 已經說明在 Model 裡面 Django Model 是否會對於這些不相對應的值進行處理?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still a problem

Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,3 @@ def post(self, request: Request, pk: int):
return Response(data=PetSerializer(pet).data, status=status.HTTP_200_OK)


def calculate_daily_energy_requirement(weight, activity_level):
activity_levels = {
'low': 1.2,
'moderate': 1.4,
'high': 1.6,
}

if activity_level not in activity_levels:
raise ValueError("Invalid activity level")

levels = activity_levels[activity_level]
return levels * 70 * (weight ** 0.75)