Assignment FAQs

Contributors: Alanna Zhou

Hi there!

Here is a list of commonly asked questions on our past Ed Discussions. We've compiled this so that you can easily ctrl+F the error you are searching for quickly! Still feel free to pop that question on Piazza though, we're happy to help. If you have a specific error, you might benefit from this page:

pageError FAQs 😢

PA1

  • Are comment ids unique within a post or globally?

    • Globally! Regardless of which post a comment belongs to, no two comments should share the same id.

  • Are we allowed to pre-populate our posts dictionary?

    • Yes. Our grading is based around how well your application conforms to the provided API Specification. The initial state of your data structure has not impact on our tests.

  • If a post has no comments, should we return an error or an empty list?

    • Empty list.

  • Why is the data in my GET response a different order from that of my dictionary? Does this matter?

    • Python dictionaries are not ordered! This will not affect the correctness of your solution.

  • If you can user query strings (/api/users/?user=username&email=email), why use body requests?

    • It's not sustainable to send large parameters, so more often than not we prefer POST. There could also also be security concerns if you could straight up see a password on the request URL

PA2

  • DB 'object' not callable?

    • You probably have a DB() somewhere in your code where DB = db.DatabaseDriver() at the top of your file

PA3

  • sqlite3.IntegrityError: FOREIGN KEY when deleting a user involved in a transaction?

    • You can either delete all of the transactions that involve the user, or you can use something called a SECONDARY KEY (instead of FOREIGN KEY). We haven't taught you about cascade deletes (chapter 4 material!) so that's partly why you're getting the foreign key constraint failed error. You can think of a secondary key as a foreign key without a reference to a specific table (it's just an identifier for a row for any table in your database). This Stack Overflow post might help.

  • Does the user input the accepted field at /api/transactions/?

    • The user does not have to give any value for accepted, or even put the accepted field into the POST body request. All this endpoint is doing is allowing the client to denote that there is a transaction that exists, but it is not necessarily a transaction that can go through. In other words, the transaction attempting to be created can be accepted later or denied later (if accepted is None, and the next endpoint in the API will allow the client to edit the transaction's accepted by id), or accepted now and denied now (accepted is True and then False). If you think about Venmo it makes sense; my friend can put in a request to pay me / request money from me, but the transaction will only go through if I accept the request to receive the payment or make the payment. The same goes the other way around if I make a request to my friend.

PA4

  • What are backref and backpopulates and how do we use them?

pageConcept FAQs
  • How to categorize a User into instructor and student?

    • Hint: Make two association tables, one for instructors/courses and one for students/courses.

  • How is the assignment class is supposed to serialize its course without referencing the course class?

    • You need to reference the course class. You can get the serialized course but omit any redundant data, for example, the assignment nested inside the course itself.

PA5

  • Are we coding anything for our Docker image?

    • Just create a Docker image with your PA4 source code!

  • Do we submit on CMS and Docker Hub?

    • Yes, and make sure that the docker-compose.yml file you submit on CMS is pointing to your image on Docker Hub. In other words, make sure that the image referenced inside of your docker-compose.yml matches the name of the Docker image that was built and pushed to DockerHub.

  • How to check that docker-compose.yml file is pointing to Docker Hub image and not a local tag?

    • You can delete the image off of your local machine with docker image rm. Then when you run docker-compose up -d, Docker will automatically pull the image off of Docker Hub!

  • Can't pull Docker image from DockerHub?

    • Check Docker Hub for your tag and see if it exists under your repository first. Your repository is just your username. Note that you should be trying to pull something that looks like <username>/<tag_name>!

Last updated