Skip to content

Latest commit

 

History

History

lesson_03

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Lesson 03: How Computers Work (Slides)

Pre-work

Please review the following resources before lecture:

Homework

Important reminders

  • Make sure to sync your fork before creating a branch in order to pull in the latest changes.
  • Sync your branch often to avoid merge conflicts and execute git pull to bring the latest changes to your machine.
  • If your branch is too far behind or you run into too many issues, feel free to delete and re-create your repository. Make sure to review the article linked at the bottom of the lesson_00 README for instructions on how to create your fork and branch properly.
  • Remember, you should not reuse a branch you've used to submit a pull request. If you need to make changes, create a new branch and work from there after you've updated your fork to the latest.

Creating new quiz questions

Now's your chance to quiz the instructor! In this assignment, you will modify the quiz project to include three quiz questions based on the content you've learned in this course so far. Feel free to choose any topic for your questions.

  1. Navigate to the quiz directory and install the required dependencies.
cd lesson_03/quiz
npm install --prefix ../../lib/javascript/codedifferently-instructional
npm install
npm start
  1. You will create a quiz file in the quizzes folder. You should model yours after the example provided in anthony_mays_quiz.ts. Note that the name of the file you create should match the name of the class in the file.
  2. Make sure to provide a unique provider name for your questions provider. You'll need this name to provide answers in step 5.
  getProviderName(): string {
    return '<your unique name goes here>';
  }
  1. Make at least three questions for your quiz and leave them unanswered.
  2. To provide answers, you will need to update the quiz.yaml file in the test directory. You can copy the example in the file to get started, but you must provide your own answers. To generate an encrypted answer, use bcrypt.online.
  3. Lastly, you'll need to modify the quizzes.module.ts file to include your quiz.
  4. Before attempting to submit your quiz, make sure to run the linter on the code and run the tests to ensure that you've updated things correctly. The commands must be run from the quiz sub-folder just like the previous assignment:
npm run check
  1. Once everything passes, submit a PR.

**Note: If you want to check that you've encoded your answers correctly, you can update you quiz with the real answers and then run the tests using the command below.

PROVIDER_NAME=<Your provider name here> npm run test

Dealing with merge conflicts

Since everyone needs to modify the same files for this assignment, you will most certainly encounter merge conflicts. To resolve this, here are the steps:

  1. Sync the main branch of your fork and ensure that it is up-to-date.
  2. Use git checkout main and git pull to get the latest updates pulled down to your computer.
  3. Checkout your feature branch (e.g. git checkout feature/lesson_03).
  4. Run git rebase main on your feature branch to pull in the latest changes and deal with merge conflicts.
  5. Use the Source Control view in VS Code to identify files with conflicts. Click to open them and use the Merge Editor to resolve conflicts.
  6. Stage and commit the changed files.
  7. Repeat steps 5-6 until the rebase is complete.

An alternative approach is to open the PR and manually edit the conflicting files to work out any issues. This may be easier for some of you, but it can also be tricky to do if you don't know what you're doing.

Check out this YouTube video for a quick explaination of what's going on.