diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3756caa..46c150e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,8 +8,12 @@ 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_ + # Your Details - Your Name: @@ -20,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/.github/workflows/close.yml b/.github/workflows/close.yml new file mode 100644 index 0000000..137dc57 --- /dev/null +++ b/.github/workflows/close.yml @@ -0,0 +1,17 @@ +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-stale: -1 + days-before-issue-close: -1 diff --git a/HOW_TO_MARK.md b/HOW_TO_MARK.md new file mode 100644 index 0000000..99bf0f0 --- /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 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 + +- 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/ diff --git a/exercises/exercise-1/exercise-1.js b/exercises/exercise-1/exercise-1.js index 10b93ba..2ff89d8 100644 --- a/exercises/exercise-1/exercise-1.js +++ b/exercises/exercise-1/exercise-1.js @@ -1,11 +1,15 @@ const personOne = { - name: 'Popeye', - age: 34, - favouriteFood: 'Spinach' -} + name: "Popeye", + age: 34, + 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}.`); +function introduceYourself(obj) { + 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 0d3ade0..d8a5a37 100644 --- a/exercises/exercise-2/exercise-2.js +++ b/exercises/exercise-2/exercise-2.js @@ -1,11 +1,94 @@ let hogwarts = [ - { firstName: "Harry", lastName: "Potter", house: "Gryffindor", pet: "Owl", 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", + }, +]; + +//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}`); +}) + + + diff --git a/exercises/exercise-3/exercise-3.js b/exercises/exercise-3/exercise-3.js index b60d527..24b5735 100644 --- a/exercises/exercise-3/exercise-3.js +++ b/exercises/exercise-3/exercise-3.js @@ -1,9 +1,32 @@ - 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 }, +]; + + +// 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); 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);