From ead4faae4671f3e996e15f8895ab600e261b2911 Mon Sep 17 00:00:00 2001 From: Chris Owen Date: Fri, 12 Mar 2021 14:54:31 +0000 Subject: [PATCH 1/8] Add HOW_TO_MARK.md --- .github/pull_request_template.md | 2 + HOW_TO_MARK.md | 64 ++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 HOW_TO_MARK.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3756caa..413f664 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -10,6 +10,8 @@ London Class 7 - Chris Owen - HTML/CSS - Week 1 --> +**Volunteers: Are you marking this coursework?** _You can find a guide on how to mark this coursework in `HOW_TO_MARK.md` in the root of this repository_ + # Your Details - Your Name: diff --git a/HOW_TO_MARK.md b/HOW_TO_MARK.md new file mode 100644 index 0000000..f085b4d --- /dev/null +++ b/HOW_TO_MARK.md @@ -0,0 +1,64 @@ + + +_This file is useful for Volunteers only_ + +## 1) Solutions + +### 1.1) Where to find solutions? + +You can find the solution to this coursework in a repository with the same name as this but with `-Solution` after the name. + +For example, for this repo: + +https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week1 + +The solutions would be found in: + +https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week1-Solution + +**If you do not have access to these repositories** then please contact your City Coordinator to get access to our Github Team. + +### 1.2) Using the Solutions Repo + +In these repositories you will find solutions to each weeks coursework. These solutions are example answers and will not be the extra solution that students give. You should use it to inform your feedback of the coursework. + +Additionally, you will find marking guides in these places + +- The `marking` folder - Used to store multiple guides on marking +- `marking.md` file - Used to store notes on common problems we're trying to address +- `solutions.md` - A file used by students for notes on best practice + +## 2) Before You Start + +### 2.1) Feedback Guide + +A guide for marking coursework can be found here. Please read it before you start. + +https://docs.codeyourfuture.io/teams/education/homework-feedback + +### 2.2) Marking Guide + +Here is a useful resources you can direct students to when you see them have common mistakes + +https://syllabus.codeyourfuture.io/guides/marking-guide + +This guide should be used when you see a student making a common mistake so instead of writing out a reply you can send them to the a good resource. + +For example, if the student is leaving in lots of comments out code you could write + +```txt +Great work so far! + +It's best if you remove code that you're not using, you can read more about this here +https://syllabus.codeyourfuture.io/guides/marking-guide#commented-out-code +``` + +### 3.3) Style Guide + +All code at CYF should follow this Style Guide + +https://syllabus.codeyourfuture.io/guides/code-style-guide/ From 768272781498a46e00a3a2d884c763f3c50c82ac Mon Sep 17 00:00:00 2001 From: Chris Owen Date: Fri, 12 Mar 2021 16:44:00 +0000 Subject: [PATCH 2/8] Typo Fix --- .github/pull_request_template.md | 12 ++++++++++++ HOW_TO_MARK.md | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 413f664..46c150e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,6 +8,8 @@ For example, London Class 7 - Chris Owen - HTML/CSS - Week 1 +Please complete the details below this message + --> **Volunteers: Are you marking this coursework?** _You can find a guide on how to mark this coursework in `HOW_TO_MARK.md` in the root of this repository_ @@ -22,3 +24,13 @@ London Class 7 - Chris Owen - HTML/CSS - Week 1 - Module: - Week: + +# Notes + +- What did you find easy? + +- What did you find hard? + +- What do you still not understand? + +- Any other notes? diff --git a/HOW_TO_MARK.md b/HOW_TO_MARK.md index f085b4d..99bf0f0 100644 --- a/HOW_TO_MARK.md +++ b/HOW_TO_MARK.md @@ -24,7 +24,7 @@ https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week1-Solution ### 1.2) Using the Solutions Repo -In these repositories you will find solutions to each weeks coursework. These solutions are example answers and will not be the extra solution that students give. You should use it to inform your feedback of the coursework. +In these repositories you will find solutions to each weeks coursework. These solutions are example answers and will not be the exact solution that students give. You should use it to inform your feedback of the coursework. Additionally, you will find marking guides in these places From 0c7cf43e97635e381f255f791ab4aff377add1ff Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Fri, 19 Mar 2021 21:21:50 +0000 Subject: [PATCH 3/8] Add Ron He's present in the expected answer in the .md file --- exercises/exercise-2/exercise-2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/exercise-2/exercise-2.js b/exercises/exercise-2/exercise-2.js index 0d3ade0..555b2ae 100644 --- a/exercises/exercise-2/exercise-2.js +++ b/exercises/exercise-2/exercise-2.js @@ -1,5 +1,6 @@ let hogwarts = [ { firstName: "Harry", lastName: "Potter", house: "Gryffindor", pet: "Owl", occupation: "Student" }, + { firstName: "Ron", lastName: "Weasley", house: "Gryffindor", pet: "Scabbers", occupation: "Student" }, { firstName: "Hermione", lastName: "Granger", house: "Gryffindor", pet: "Cat", occupation: "Student" }, { firstName: "Draco", lastName: "Malfoy", house: "Slytherin", pet: null, occupation: "Student" }, { firstName: "Cedric", lastName: "Diggory", house: "HufflePuff", pet: null, occupation: "Student" }, From 266d340d61a359658e2e51a3b38da489c461188c Mon Sep 17 00:00:00 2001 From: Chris Owen Date: Thu, 1 Apr 2021 14:49:25 +0100 Subject: [PATCH 4/8] Formatting --- exercises/exercise-1/exercise-1.js | 14 ++--- exercises/exercise-2/exercise-2.js | 82 ++++++++++++++++++++++++++---- exercises/exercise-3/exercise-3.js | 17 +++---- practice/code-reading.md | 2 +- 4 files changed, 88 insertions(+), 27 deletions(-) diff --git a/exercises/exercise-1/exercise-1.js b/exercises/exercise-1/exercise-1.js index 10b93ba..a6eab29 100644 --- a/exercises/exercise-1/exercise-1.js +++ b/exercises/exercise-1/exercise-1.js @@ -1,11 +1,13 @@ const personOne = { - name: 'Popeye', - age: 34, - favouriteFood: 'Spinach' -} + name: "Popeye", + age: 34, + favouriteFood: "Spinach", +}; function introduceYourself(___________________________) { - console.log (`Hello, my name is ${name}. I am ${age} years old and my favourite food is ${favouriteFood}.`); + console.log( + `Hello, my name is ${name}. I am ${age} years old and my favourite food is ${favouriteFood}.` + ); } -introduceYourself(personOne); \ No newline at end of file +introduceYourself(personOne); diff --git a/exercises/exercise-2/exercise-2.js b/exercises/exercise-2/exercise-2.js index 555b2ae..e11b75e 100644 --- a/exercises/exercise-2/exercise-2.js +++ b/exercises/exercise-2/exercise-2.js @@ -1,12 +1,72 @@ let hogwarts = [ - { firstName: "Harry", lastName: "Potter", house: "Gryffindor", pet: "Owl", occupation: "Student" }, - { firstName: "Ron", lastName: "Weasley", house: "Gryffindor", pet: "Scabbers", occupation: "Student" }, - { firstName: "Hermione", lastName: "Granger", house: "Gryffindor", pet: "Cat", occupation: "Student" }, - { firstName: "Draco", lastName: "Malfoy", house: "Slytherin", pet: null, occupation: "Student" }, - { firstName: "Cedric", lastName: "Diggory", house: "HufflePuff", pet: null, occupation: "Student" }, - { firstName: "Severus", lastName: "Snape", house: "Slytherin", pet: null, occupation: "Teacher" }, - { firstName: "Filius", lastName: "Flitwick", house: "Ravenclaw", pet: null, occupation: "Teacher" }, - { firstName: "Pomona", lastName: "Sprout", house: "Hufflepuff", pet: null, occupation: "Teacher" }, - { firstName: "Minerva", lastName: "McGonagall", house: "Gryffindor", pet: null, occupation: "Teacher" }, - { firstName: "Albus", lastName: "Dumbledore", house: "Gryffindor", pet: "Phoenix", occupation: "Teacher" } -] + { + firstName: "Harry", + lastName: "Potter", + house: "Gryffindor", + pet: "Owl", + occupation: "Student", + }, + { + firstName: "Ron", + lastName: "Weasley", + house: "Gryffindor", + pet: "Scabbers", + occupation: "Student", + }, + { + firstName: "Hermione", + lastName: "Granger", + house: "Gryffindor", + pet: "Cat", + occupation: "Student", + }, + { + firstName: "Draco", + lastName: "Malfoy", + house: "Slytherin", + pet: null, + occupation: "Student", + }, + { + firstName: "Cedric", + lastName: "Diggory", + house: "HufflePuff", + pet: null, + occupation: "Student", + }, + { + firstName: "Severus", + lastName: "Snape", + house: "Slytherin", + pet: null, + occupation: "Teacher", + }, + { + firstName: "Filius", + lastName: "Flitwick", + house: "Ravenclaw", + pet: null, + occupation: "Teacher", + }, + { + firstName: "Pomona", + lastName: "Sprout", + house: "Hufflepuff", + pet: null, + occupation: "Teacher", + }, + { + firstName: "Minerva", + lastName: "McGonagall", + house: "Gryffindor", + pet: null, + occupation: "Teacher", + }, + { + firstName: "Albus", + lastName: "Dumbledore", + house: "Gryffindor", + pet: "Phoenix", + occupation: "Teacher", + }, +]; diff --git a/exercises/exercise-3/exercise-3.js b/exercises/exercise-3/exercise-3.js index b60d527..0a01f8f 100644 --- a/exercises/exercise-3/exercise-3.js +++ b/exercises/exercise-3/exercise-3.js @@ -1,9 +1,8 @@ - let order = [ - { itemName: "Hot cakes", quantity: 1, unitPrice: 2.29}, - { itemName: "Apple Pie", quantity: 2, unitPrice: 1.39}, - { itemName: "Egg McMuffin", quantity: 1, unitPrice: 2.80}, - { itemName: "Sausage McMuffin", quantity: 1, unitPrice: 3.00}, - { itemName: "Hot Coffee", quantity: 2, unitPrice: 1.00}, - { itemName: "Hash Brown", quantity: 4, unitPrice: 0.40} - ] - \ No newline at end of file +let order = [ + { itemName: "Hot cakes", quantity: 1, unitPrice: 2.29 }, + { itemName: "Apple Pie", quantity: 2, unitPrice: 1.39 }, + { itemName: "Egg McMuffin", quantity: 1, unitPrice: 2.8 }, + { itemName: "Sausage McMuffin", quantity: 1, unitPrice: 3.0 }, + { itemName: "Hot Coffee", quantity: 2, unitPrice: 1.0 }, + { itemName: "Hash Brown", quantity: 4, unitPrice: 0.4 }, +]; diff --git a/practice/code-reading.md b/practice/code-reading.md index 72651a2..130ef6c 100644 --- a/practice/code-reading.md +++ b/practice/code-reading.md @@ -6,7 +6,7 @@ Take a look at the following code: ``` 1 let x = 1; -2 function f1() +2 function f1() 3 { 4 let x = 2; 5 console.log(x); From f80e04eb4d3006e0f89ecf1fc666b64f6dbd4154 Mon Sep 17 00:00:00 2001 From: Chris Owen Date: Thu, 13 May 2021 14:19:21 +0100 Subject: [PATCH 5/8] Close PRs after six weeks --- .github/workflows/close.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/close.yml diff --git a/.github/workflows/close.yml b/.github/workflows/close.yml new file mode 100644 index 0000000..0b9f896 --- /dev/null +++ b/.github/workflows/close.yml @@ -0,0 +1,16 @@ +name: "Close stale issues and PRs" +on: + workflow_dispatch: + schedule: + - cron: "30 1 * * *" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + stale-pr-message: "Your coursework submission has been closed because nobody has interacted with it in six weeks. You are welcome to re-open it to get more feedback." + days-before-stale: 42 + days-before-close: 0 + days-before-issue-close: -1 From dc1cd42f541368f830ddc24cadc45f800d97c2fe Mon Sep 17 00:00:00 2001 From: Chris Owen Date: Thu, 13 May 2021 16:41:51 +0100 Subject: [PATCH 6/8] Update close.yml --- .github/workflows/close.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/close.yml b/.github/workflows/close.yml index 0b9f896..137dc57 100644 --- a/.github/workflows/close.yml +++ b/.github/workflows/close.yml @@ -13,4 +13,5 @@ jobs: stale-pr-message: "Your coursework submission has been closed because nobody has interacted with it in six weeks. You are welcome to re-open it to get more feedback." days-before-stale: 42 days-before-close: 0 + days-before-issue-stale: -1 days-before-issue-close: -1 From 1c7daab6e92935164a87d74fd6bd3948944363cf Mon Sep 17 00:00:00 2001 From: LexiisYing Date: Sun, 12 Feb 2023 21:06:06 +0000 Subject: [PATCH 7/8] exercises 1 & 2 completed --- exercises/exercise-1/exercise-1.js | 2 ++ exercises/exercise-2/exercise-2.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/exercises/exercise-1/exercise-1.js b/exercises/exercise-1/exercise-1.js index a6eab29..07beef7 100644 --- a/exercises/exercise-1/exercise-1.js +++ b/exercises/exercise-1/exercise-1.js @@ -4,6 +4,8 @@ const personOne = { favouriteFood: "Spinach", }; +const {name, age, favouriteFood} = personOne; + function introduceYourself(___________________________) { console.log( `Hello, my name is ${name}. I am ${age} years old and my favourite food is ${favouriteFood}.` diff --git a/exercises/exercise-2/exercise-2.js b/exercises/exercise-2/exercise-2.js index e11b75e..ae91fe4 100644 --- a/exercises/exercise-2/exercise-2.js +++ b/exercises/exercise-2/exercise-2.js @@ -70,3 +70,25 @@ let hogwarts = [ occupation: "Teacher", }, ]; + +// task 1 +hogwarts.filter(obj => { +let {house} = obj; + return house === "Gryffindor"; + +}).forEach(obj => { +let {firstName, lastName} = obj; +console.log(`${firstName} ${lastName}`); +}) + +// task 2 +hogwarts.filter(teacher => { +let {occupation} = teacher; + return occupation === "Teacher" && teacher.pet !== null; +}).forEach(teacher => { +let {firstName, lastName} = teacher; +console.log(`${firstName} ${lastName}`); +}) + + + From b208f6d544de4627f50d6ae0fdce81bd6f2f2bae Mon Sep 17 00:00:00 2001 From: LexiisYing Date: Sat, 18 Feb 2023 23:26:24 +0000 Subject: [PATCH 8/8] exercise completed --- exercises/exercise-1/exercise-1.js | 2 +- exercises/exercise-2/exercise-2.js | 2 +- exercises/exercise-3/exercise-3.js | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/exercises/exercise-1/exercise-1.js b/exercises/exercise-1/exercise-1.js index 07beef7..2ff89d8 100644 --- a/exercises/exercise-1/exercise-1.js +++ b/exercises/exercise-1/exercise-1.js @@ -6,7 +6,7 @@ const personOne = { const {name, age, favouriteFood} = personOne; -function introduceYourself(___________________________) { +function introduceYourself(obj) { console.log( `Hello, my name is ${name}. I am ${age} years old and my favourite food is ${favouriteFood}.` ); diff --git a/exercises/exercise-2/exercise-2.js b/exercises/exercise-2/exercise-2.js index ae91fe4..d8a5a37 100644 --- a/exercises/exercise-2/exercise-2.js +++ b/exercises/exercise-2/exercise-2.js @@ -71,7 +71,7 @@ let hogwarts = [ }, ]; -// task 1 +//task 1 hogwarts.filter(obj => { let {house} = obj; return house === "Gryffindor"; diff --git a/exercises/exercise-3/exercise-3.js b/exercises/exercise-3/exercise-3.js index 0a01f8f..24b5735 100644 --- a/exercises/exercise-3/exercise-3.js +++ b/exercises/exercise-3/exercise-3.js @@ -6,3 +6,27 @@ let order = [ { itemName: "Hot Coffee", quantity: 2, unitPrice: 1.0 }, { itemName: "Hash Brown", quantity: 4, unitPrice: 0.4 }, ]; + + +// In `exercise-3.js`, you have been provided with a takeout order. +// Write a program that will print out the receipt for this order. +// - Log each individual item to the console. +// - Log the total cost of the order to the console. + +function printReceipt (order) +{ + console.log(`QTY ITEM TOTAL`); + order.forEach(({ itemName, quantity, unitPrice }) => { + console.log( + `${quantity.toString().padEnd(7)}${itemName.padEnd(20)}${unitPrice}` + ); + }); + console.log( + `Total: ${order.reduce( + (a, { quantity, unitPrice }) => a + quantity * unitPrice, + 0 + )}` + ); +}; + +printReceipt(order);