---
# System prepended metadata

title: '<center><i class="fa fa-edit"></i> Smart Dispenser: `members_addtional_card` Bug Fix </center>'
tags: [Internship]

---

# <center><i class="fa fa-edit"></i> Smart Dispenser: `members_addtional_card` Bug Fix </center>
###### tags: `Internship`
:::info
**Goal:**
- [x] Bug fix for else statement of inserting cards

**Resources:**
My subfunction code
[Upload Link](https://hackmd.io/0PkbVJ3MRnC6fq_P885uBg?view)
:::

## Bug fixes
![](https://i.imgur.com/20Cfn3q.png)

Currently gives the wrong primary card when extracting from the system 

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

Issue: found primaryCard = additionalCard but did system did not take into account of SchoolID = s. 
![](https://i.imgur.com/Xni6NnA.png)
Rewrote the expression so that there is an $eq operator for SchoolID = s

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

Still remains issue for 5-digit IDs

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

![reference link](https://i.imgur.com/IVWvWwA.png)
Issue: the length of the primaryCard ID does not depend on the length of the SchoolID (s) or the length of the additional card ID (t). It depends on what the original input was so I have created a try except statement. 

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

(FOR BOTH THE IF AND THE ELSE STATEMENT IN MAIN CODE)

Also deleted occurences of global variables t and x.