Skip to content
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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?
17 changes: 17 additions & 0 deletions .github/workflows/close.yml
Original file line number Diff line number Diff line change
@@ -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
64 changes: 64 additions & 0 deletions HOW_TO_MARK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!--
Do not edit this file.
Make a change to the template and then pull changes.
https://github.com/CodeYourFuture/CYF-Coursework-Template
-->

_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/
18 changes: 11 additions & 7 deletions exercises/exercise-1/exercise-1.js
Original file line number Diff line number Diff line change
@@ -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);
introduceYourself(personOne);
103 changes: 93 additions & 10 deletions exercises/exercise-2/exercise-2.js
Original file line number Diff line number Diff line change
@@ -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}`);
})



41 changes: 32 additions & 9 deletions exercises/exercise-3/exercise-3.js
Original file line number Diff line number Diff line change
@@ -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}
]

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);
2 changes: 1 addition & 1 deletion practice/code-reading.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down