Thursday, May 7, 2009

TA4

Our TA4 submission was probably our best one of all. And we didn't even work in the lab together the final Sunday! All of us worked together over gmail/gchat and got our respective tasks done. Not to mention we all had worked hard on our own piece of the final project before the weekend to avoid the clusterf*ck that had been our last two submissions.

My job was to implement the Class Search and Applicant Search. What I did was create various fields to narrow down search results. For example I had a "What semester?" dropdown, and an "Assigned Or Unassigned TAs" dropdown, a multiselect box of all specializations, a select field for programming languages, instructors, previous courses. All of these could be used to narrow applicants results.

The way I implemented the search was by starting with every ApplicationEntry we had in the datastore. I would .get() each ApplicationEntry's key and use it as the key in a dictionary, results_dict. For the values, I used a boolean value that was initially set to True. As each field was probed for input, I would run through the dictionary, only modifying an entry if the input in the respective field restricted the Applicant from being returned as a result.

Thus, if the user wants ApplicantEntrys from the semester Fall 2009, we would test the semesterKey in each ApplicationEntry to see if it was Fall 2009. If not, we set the value in results_dict to False.

We did this for each field that showed input, and then once we were done, we built a list of all ApplicationEntrys that were still True in results_dict after all search fields were completed, and returned the list to the django template file, where the results were displayed.

Our project probably looked the most basic out of all of them, but since the graders say they weren't taking points off for how the app looked, we did not care.

No comments:

Post a Comment