---
# System prepended metadata

title: '<center><i class="fa fa-edit"></i> Smart Dispenser: `members_addtional_Card` Subfunction Trial Report </center>'
tags: [Internship]

---

# <center><i class="fa fa-edit"></i> Smart Dispenser: `members_addtional_Card` Subfunction Trial Report </center>
###### tags: `Internship`
:::info
**Goal:**
- [x] Final changes to code
- [x] Report of all possible test case

**Resources:**
[PyQt](https://hackmd.io/Ibk_VuuWRXOjkION4wk3tg)
[newXinXingPyQtStructure](https://drive.google.com/drive/u/0/folders/1Ahr8zkZgUv8ujauLKGz1ZSzkZq0M9_mx)
[CodiMD](https://hackmd.io/c/codimd-documentation/%2F%40codimd%2Fextra-supported-syntax#Flow-Chart)
[冠辰參考的筆記](https://www.wongwonggoods.com/page/4/?s=pyqt&ct_post_type=post%3Apage&ct_product_price=1)
:::

---
:::spoiler **Expand Catalog**
[TOC]
:::

---
## Figures
*Figure 1. Open a new collection members_additional_card*
![](https://i.imgur.com/HIZq4rs.jpg)

*Figure 2. Flowchart*
![](https://i.imgur.com/KeSi6dk.jpg)

---
### Changes to Code
:::warning
Ended up making a count function in addition to the planned ones ([can be referenced here](https://hackmd.io/@tiffanycheng/ry3LHLn55))
:::
* A count function was added to count all occurrences of the user with the primary card ID in `members_addtional_card`.
* The design of `members_addtionl_card` (as seen in Figure 1) is that the first occurence of the student ID should have the `primaryCard` field equal to the `addtionalCard` field.
* Originally thought there would be a count function in `XinxingQt.py` since it is served to query and update the collection. However, it did not include one.
* The count function counts the number of occurences of the student ID in `members_addtional_card`. 
    * If it is zero, then I am able to add two inputs: the `primaryCard` == `addtionalCard` input and the input of the additional card. 
    * If it is greater than zero, I just have to add the latter input 

![](https://i.imgur.com/4y7CbYr.png)

**Main Code**
* The data returned from Membersdata function is a dictionary object and does not have access to the partition function.
* Therefore I first parsed the data as a string before partitioning. 
* Also changed the substring from [0:9] to [0:10] to make sure all 10 integers from the ID are retrieved. 
* if-else statement added in case it is the first time the user is inputing an addtional card. This way both inputs are added when count == 0. Otherwise only one ipnut is needed. 

![](https://i.imgur.com/ozYf9tV.png)

## Test Trials 
### 0.1 Re-enter schoolID and Register as new user buttons
Re-enter schoolID:

![](https://i.imgur.com/jvqseRq.png)

![](https://i.imgur.com/7IMWPFY.png)

Register as new user:

![](https://i.imgur.com/jvqseRq.png)

![](https://i.imgur.com/ftbMAjq.png)

:::success
both pop-ups close after clicking ok
:::

### 0.2 Hit cancel on run

![](https://i.imgur.com/sAWs42E.png)

:::danger
System closed after hitting cancel. 
:::

### 0.3 Hit cancel on addtional card input 

![](https://i.imgur.com/RtrMZtV.png)

:::danger
System closed after hitting cancel. 
:::
### 1. ID input is > 8 digits
![](https://i.imgur.com/2dwgov1.png)

![](https://i.imgur.com/9pqWgg7.png)

![](https://i.imgur.com/jvqseRq.png)

### 2. ID input is > 8 digits
![](https://i.imgur.com/jMx3egd.png)

![](https://i.imgur.com/9pqWgg7.png)

![](https://i.imgur.com/jvqseRq.png)

### 3. ID input contains non digit values

![](https://i.imgur.com/KHF5ZFF.png)

![](https://i.imgur.com/7twuBxC.png)

![](https://i.imgur.com/jvqseRq.png)

### 4. ID input is 8 digits but *is not* in `members_data`
![](https://i.imgur.com/ap1ujpc.png)

![](https://i.imgur.com/Vr7O3CU.png)

### 5. ID input is 8 digits and is in `members_data`. Do not want to input addtional card. 
![](https://i.imgur.com/d2FS15A.png)

![](https://i.imgur.com/gbaTT8S.png)

![](https://i.imgur.com/Odjk9XD.png)

![](https://i.imgur.com/yxtCVsa.png)

:::danger
Clicked no and system closed.
:::

### 6. ID input is 8 digits and is in `members_data`. Want to input addtional card.
![](https://i.imgur.com/d2FS15A.png)

![](https://i.imgur.com/gbaTT8S.png)

![](https://i.imgur.com/Odjk9XD.png)

![](https://i.imgur.com/yxtCVsa.png)

:::success
Clicked yes
:::

### 6.1 ID input is > 10 digits

![](https://i.imgur.com/lSALvif.png)

![](https://i.imgur.com/QnojHhK.png)

![](https://i.imgur.com/DpOY783.png)

### 6.2 ID input is < 10 digits 
![](https://i.imgur.com/raQ3I1S.png)

![](https://i.imgur.com/QnojHhK.png)

![](https://i.imgur.com/6RfDfL3.png)

### 6.2 ID input contains non digit values

![](https://i.imgur.com/zHXp9CX.png)

![](https://i.imgur.com/NsxXCXh.png)

![](https://i.imgur.com/6RfDfL3.png)

### 6.3 ID input is 10 digits and is first time adding additional card
![](https://i.imgur.com/mhs9jh9.png)

![](https://i.imgur.com/G54DFX4.png)

![](https://i.imgur.com/MbBbz9b.png)

### 6.4 ID input is 10 digits but same as registered primary card 
![](https://i.imgur.com/mhs9jh9.png)

![](https://i.imgur.com/Ml70mGW.png)

![](https://i.imgur.com/Rcq812s.png)
### 6.5 ID input is 10 digits but same as a registered additonal card 
![](https://i.imgur.com/mhs9jh9.png)

![](https://i.imgur.com/G54DFX4.png)

![](https://i.imgur.com/THvhB4O.png)

### 6.6 ID input is 10 digits but additional card is an unregistered user's card 

![](https://i.imgur.com/mhs9jh9.png)

![](https://i.imgur.com/HnBejVz.png)

![](https://i.imgur.com/JTrtl8F.png)

![](https://i.imgur.com/CASQAVt.png)

![](https://i.imgur.com/0J8RNAY.png)
