# <center><i class="fa fa-edit"></i> Smart Dispenser API Beta Testing Items 9-13 </center>
###### tags: `Internship`
:::info
**Goal:**
Test the newly written API for the Smart Dispenser with Postman. Specifically, whether items 9~13 produce a normal response with the examples not produced in the HackMD page.
- [x] 9. 各類期間取水次數/取水量 數據&百分比
- [x] 10. 學生: 各類總人數, 各類取水人數, 各類取水人數百分比
- [x] 11. 統計:學生: 各類學生每人每日取水量分布
- [x] 12. 學生: 各類別期間每日三種水(冷水 溫水 熱水)的取水量與取水百分比
- [x] 13. 學生: 各類別各學生在某一天期間取水量CDF
**Resources:**
[Xinxing Trig API Document](https://hackmd.io/@RenJhang/rkDFsbBr5)
[Smart Dispenser Project](https://hackmd.io/@RayCheng/HJk_YpRou)
[新興國中開始畫圖數據觀察](https://hackmd.io/@RenJhang/SJpi2dsy9)
:::
---
:::spoiler **Expand Catalog**
[TOC]
:::
---
## Configuration: 確認API程式是否在運行

---
## 9. 各類期間取水次數/取水量 數據&百分比
### Post
```
http://140.118.122.115:15034/statistic/all/classes/waterIntakeAndPercent
```
### Key
| key | value(choose 1) | remark |
| --------------- | --------------------------------- | ------------------------------------------------- |
| "IdentityLimit" | "Student"<br>"Faculty"<br>"False" | 只看學生<br>只看教職員<br>都看 |
| "StudentScale" | "Class"<br>"Grade"<br>"All" | 以班級為單位<br>以年級為單位<br>以全校學生為單位 |
| "StudentGender" | "True"<br>"False" | "True": 要再分性別<br>"False": 沒有要再分性別 |
| "IllegalScale" | "All"<br>"Detail" | 統一顯示為非法輸入<br>區分學號/工號形式的非法輸入 |
### Postman Trials
:::success
**Trial 1**
Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"IdentityLimit":"Student",
"StudentScale":"Grade",
"StudentGender":"True",
"IllegalScale":"All"
}
```

:::
:::success
Trial 2
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"IdentityLimit":"Student",
"StudentScale":"All",
"StudentGender":"False",
"IllegalScale":"All"
}
```

:::
:::success
Trial 3
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"IdentityLimit":"False",
"StudentScale":"All",
"StudentGender":"False",
"IllegalScale":"Detail"
}
```

:::
:::danger
Trial 4
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"IdentityLimit":"Faculty",
"StudentScale":"Class",
"StudentGender":"True",
"IllegalScale":"All"
}
```

:::
:::danger
Trial 5
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"IdentityLimit":"Faculty",
"StudentScale":"Class",
"StudentGender":"False",
"IllegalScale":"All"
}
```

:::
:::danger
Trial 6
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"IdentityLimit":"Faculty",
"StudentScale":"Grade",
"StudentGender":"True",
"IllegalScale":"All"
}
```

:::
:::danger
Trial 7
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"IdentityLimit":"Faculty",
"StudentScale":"Grade",
"StudentGender":"False",
"IllegalScale":"All"
}
```

:::
:::danger
Trial 8
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"IdentityLimit":"Faculty",
"StudentScale":"All",
"StudentGender":"True",
"IllegalScale":"All"
}
```

:::
:::danger
Trial 9
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"IdentityLimit":"Faculty",
"StudentScale":"All",
"StudentGender":"False",
"IllegalScale":"All"
}
```

:::
### 總結
:::info
所有包含`“IdentityLimit”:“Faculty”`都有`overload`或`error` (詳情請看 Trial 4~9)
:::
---
## 10. 學生: 各類總人數, 各類取水人數, 各類取水人數百分比
### Post
```
http://140.118.122.115:15034/statistic/student/classes/waterIntakePeopleNumAndPercent
```
### Key
| key | value(choose 1) | remark |
| -------- | -------- | -------- |
| "StudentScale" | "Class"<br>"Grade"<br>"All" | 以班級為單位<br>以年級為單位<br>以全校學生為單位 |
| "StudentGender" | "True"<br>"False" | "True": 要再分性別<br>"False": 沒有要再分性別 |
### Postman Trials
:::success
Trial 1
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"Grade",
"StudentGender":"True"
}
```

:::
:::success
Trial 2
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"All",
"StudentGender":"True"
}
```

:::
:::success
Trial 3
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"Class",
"StudentGender":"False"
}
```

:::
:::success
Trial 4
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"Grade",
"StudentGender":"False"
}
```

:::
:::success
Trial 5
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"All",
"StudentGender":"False"
}
```

:::
### 總結
:::info
cleared, all normal responses
:::
---
## 11. 統計:學生: 各類學生每人每日取水量分布
### Post
```
http://140.118.122.115:15034/statistic/student/classes/eachClassMemberAccumulatedTakeWaterDistribution
```
### Key
| key | value(choose 1) | remark |
| --------------- | --------------------------- | ------------------------------------------------ |
| "StudentScale" | "Class"<br>"Grade"<br>"All" | 以班級為單位<br>以年級為單位<br>以全校學生為單位 |
| "StudentGender" | "True"<br>"False" | "True": 要再分性別<br>"False": 沒有要再分性別 |
### Postman Trials
:::success
Trial 1
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"Class",
"StudentGender":"False"
}
```

:::
:::danger
Trial 2
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"Grade",
"StudentGender":"True"
}
```

:::
:::success
Trial 3
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"Grade",
"StudentGender":"False"
}
```

:::
:::success
Trial 4
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"All",
"StudentGender":"True"
}
```

:::
:::success
Trial 5
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"All",
"StudentGender":"False"
}
```

:::
### 總結
:::info
`"StudentScale":"Grade", "StudentGender":"True"` 有`overload`或`error` (詳情請看 Trial 2)
:::
---
## 12. 學生: 各類別期間每日三種水(冷水 溫水 熱水)的取水量與取水百分比
### Post
```
http://140.118.122.115:15034/statistic/student/classes/eachClassEachDayThreeKindWaterVolumeAndPercent
```
### Key
| key | value(choose 1) | remark |
| --------------- | --------------------------- | ------------------------------------------------ |
| "StudentScale" | "Class"<br>"Grade"<br>"All" | 以班級為單位<br>以年級為單位<br>以全校學生為單位 |
| "StudentGender" | "True"<br>"False" | "True": 要再分性別<br>"False": 沒有要再分性別 |
### Postman Trials
:::success
Trial 1
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"Class",
"StudentGender":"False"
}
```

:::
:::success
Trial 2
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"Grade",
"StudentGender":"True"
}
```

:::
:::success
Trial 3
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"Grade",
"StudentGender":"False"
}
```

:::
:::success
Trial 4
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"All",
"StudentGender":"True"
}
```

:::
:::success
Trial 5
- Body: raw - JSON
```
{
"start":"2021-11-30",
"end":"2021-11-30",
"StudentScale":"All",
"StudentGender":"False"
}
```

:::
### 總結
:::info
cleared, all normal responses
:::
---
## 13. 學生: 各類別各學生在某一天期間取水量CDF
### Post
```
http://140.118.122.115:15034/statistic/student/classes/eachClassEachStudentTakeWaterCDF
```
### Key
| key | value(choose 1) | remark |
| --------------- | --------------------------- | ------------------------------------------------ |
| "StudentScale" | "Class"<br>"Grade"<br>"All" | 以班級為單位<br>以年級為單位<br>以全校學生為單位 |
| "StudentGender" | "True"<br>"False" | "True": 要再分性別<br>"False": 沒有要再分性別 |
### Postman Trials
:::success
Trial 1
- Body: raw - JSON
```
{
"specific_date":"2021-11-30",
"StudentScale":"Class",
"StudentGender":"False"
}
```

:::
:::danger
Trial 2
- Body: raw - JSON
```
{
"specific_date":"2021-11-30",
"StudentScale":"Grade",
"StudentGender":"True"
}
```

:::
:::success
Trial 3
- Body: raw - JSON
```
{
"specific_date":"2021-11-30",
"StudentScale":"Grade",
"StudentGender":"False"
}
```

:::
:::success
Trial 4
- Body: raw - JSON
```
{
"specific_date":"2021-11-30",
"StudentScale":"All",
"StudentGender":"True"
}
```

:::
:::success
Trial 5
- Body: raw - JSON
```
{
"specific_date":"2021-11-30",
"StudentScale":"All",
"StudentGender":"False"
}
```

:::
### 總結
:::info
`"StudentScale":"Grade", "StudentGender":"True"` 有`overload`或`error` (詳情請看 Trial 2)
:::