# Documentation on AnswerBook and Grader
## Starting Points
#### Mock Exam
For the **Final Exam**, the work on **Grader** & **AnswerBook** started from the latest version in `OneDrive/Teaching/AY2020-21-T1/CIR1305 - SMA/Uploads/MockExam`

- Base version of Grader: `Grader-V2.1.xlsm` (10 Jun 2020 12:50) 
	- Copied and saved as `Grader.xlsm`  
- Base version of the Answer Book: `AnswerBook.xlsm` (5 Jun 2020 12:34): Saved as `AnswerBook-S3.xlsm`  
	- We will be using a version without macros `AnswerBook.xlsx`   

### Passwords
#### For the unused AnswerBook-S3.xlsm version

* **Overall password**: `Public Const PublicKey = cat`
* **Cryptographic salt**: `Private Const SALT = @+k*$Tb9=^R&HUba` 
* **Structure**: `Private Const PrivateKey = CAT^2!=SMA#*`  
	- To Unprotect Workbook, which is found in the **Review** Ribbon  
* **VBA Project**: Password = `SMA>=CAT!`


## To do (for the Final Exam)
### AnswerBook
 - Make the section selection a drop down, with auto filling of the section timing. (Maybe a VBA selection?)
 	- Done. Used `XLOOKUP`
 - Provide a function to change password (in personal?)
 	- Not needed: Using a non-macro-enabled Answer Book. 

### Grader
 - Update Grader to handle `xlsx` files
 	- Grade directly in the Answer Book - no need to `recoverFile()`
 	- Simplify the `AnswerBook.xlsm` handling functions, like audit checks, unlocking etc.
 	- Improve the CSV creation: Save student name, id and section number from the Cover sheet

___

## Detailed Steps

#### Creating an unlocked version of the AnswerBook 
 - Recommended Name is `AnswerBook-Unlocked.xlsm`
 - Remove / Save all the code in the **ThisWoorkbook** object (e.g. in `ThisWorkbook.bas`)
 - Save `AnswerBook.xlsm` and rename it to `AnswerBook-Unlocked.xlsm`

#### Typical modifications in `AnswerBook-Unlocked.xlsm`
 - Questions (in sheets like **Q1**, **Q2**)
 - Section numbers (in the **Cover** sheet)

#### Changing Passwords [*Optional*]
 - Work on the unlocked `AnswerBook-Unlocked.xlsm` file
 - Change **passwords** and **salt** (if needed, in VBA, **Module1**)
 - Be *very careful* to copy and *save* the **passwords** & **salt** (Best to export/save **Module1** as `Module1.bas` after password change)
 - Ensure that the changes in the VBA module **Module1** and the file `Module1.bas` match
 - Propagate the changes to
   - `PERSONAL.XLSB` in the **FromAnswerBook** module
   - `Grader.xlsm` in the **UserSpecific** module (Change `Private` to `Public`)

#### Re-locking `AnswerBook-Unlocked.xlsm`
 - Copy `AnswerBook-Unlocked.xlsm` as `AnswerBook.xlsm`
 - Remember not to rename and lose the unlocked version `AnswerBook-Unlocked.xlsm`
 - Reinstate the code saved in `Module1.bas` back to the new `AnswerBook.xlsm` as **Module1**
 - Save it!

 ## To Do: General Improvements
 
 1. Ensure that `PERSONAL.XLSB` is consistent with `AnswerBook` and `Grader`
 1. Do we need `PERSONAL.XLSB` at all?
 1. In unlocking AnswerBook in `PERSONAL.XLSB`, ensure that we unhide all sheets by looping
 1. Implement a `nQues` in all files. 
 	1. Can we loop over an array without using its index? If so, we don't need `nQues`.

