Model United Nations - A Software Approach
- 7 Devlogs
- 15 Total hours
Backend for MUN conference hosting and administration.
Backend for MUN conference hosting and administration.
Fully debugged my Command Line Interface after moving everything into OOP.
Change twin logic variable call (it was supposed to call list index 0, but called 1) to solve linking issue for double delegate committees.
Fix relative imports by adding “.” to my init.py files. During this I learned a lot about how the python interpreter views files and locations.
Also separated responsibilities by splitting functions. Now, my libraries are no longer aware of each other, to allow for easier debug and changes later.
I will need to take out my business logic from the infrastructure and put it with my main files, to further separate responsibilties.
Moved everything into Object Oriented Programming Classes
This included Gmail, Sheets, and Drive Functions. I will probably do the same for the other folders soon, but they are not connected.
I have yet to fully debug the command line interface, especially after these changes. Will do that soon.
Continued debugging my command line interface and adding some necessary business features.
Previously a new committee was only checked against the main list of names. Now, it is split by type of committee to prevent switching between types.
Add ability to print suggestions to user if committee selections are double, advising them to change the other delegate in the same committee if needed.
Fix twin logic error and place code into more organized functions.
With this part of the debugging, I began to understand the importance of splitting all code into functions, and grouping those functions into classes. Previously, all my code was a rough draft minimum viable product designed to just get the job done. Now, with the need to edit things in the future and share with other developers in my team, I began to sort things into functions (which turn out to be amazingly useful and easy to debug). In the next update I might begin writing classes.
Began debugging my command line interface code.
Most of these errors were small bugs in the system, not major conceptual issues. However, I did learn how to use the VSCode debugging feature while going through this, as it is a program that is easy to set breakpoints in and analyze variables.
Finished making the Command Line Interface. It checks for availability whenever the user inputs assignments in the questionary interface using sets. Stores all assignments in a dictionary, which is then converted into a cell map after the user finished all assignments. This cell map accurately recreates the cells that were pulled, except that used assignments now get blank cells. School assignments go into a separate sheet, where they are listed as “country name (committee name)”.
During this process I learned a lot about safely converting data between types, i.e. from dictionaries to lists to sets, and their respective advantages for later processing. For example, sets are great with the “in” keyword, which gives O(1) time complexity, an important feature when I expect datasets with 800+ values.
I also learned some intuitive strategies on improving code efficiency. Instead of writing multiple for loops, using tuples to do multiple jobs within one loop is usually much more efficient.
Converting the dictionary that contains {(“committee”, “country_name”): “sheet_coordinate”} into a dictionary with the sheet coordinate as the key and the value as committee and country name took some thought and studying into dictionary rules in python.
The function add_assignments_and_map_cells() took a lot of editing. What started as a simple questionary function that returns user inputs in a dictionary evolved into a full input-checker and cell mapper. I originally wanted the latter process to happen in the main code, but I discovered that the function had all necessary variables, and that it would be cleaner to simply pass back all the completed variables.
Also decided that pushes are inherently untrustworthy, because my data goes from Google Sheets into a dictionary into a cell map, and finally back to Google Sheets. Multiple edge cases and errors may be possible during this time. Implemented a basic checker at the very end to confirm against the counta() function built into the sheet.
Screenshot is not all; have yet to test the code for errors. Very excited to see this work! It used to take dozens of hours to complete, with plenty of human errors (especially double assignments), but with the loop pushing final values after every school and only operating within the list of possible assignments, many human errors are eliminated.
Added an Inquirer to confirm committee auto-assignments and add assignments manually.
Finished committee auto-selection greedy algorithm, accounting for double delegation committees and committee types.