Skip to content

Commit 552c0e3

Browse files
authored
Merge branch 'fullstack-hy2020:source' into ptbr-translation
2 parents 1cfaef5 + fd2a258 commit 552c0e3

File tree

21 files changed

+42
-38
lines changed

21 files changed

+42
-38
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
cd public
2929
pwd
3030
ls -la
31-
- name: wtf
31+
- name: Gatsby Publish
3232
uses: enriikke/gatsby-gh-pages-action@v2
3333
with:
3434
access-token: ${{ secrets.SEKRED2 }}
35-
35+

src/content/0/en/part0a.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ By submitting all exercises for part 13 of the course on Relational databases, y
174174
175175
How to study the course – instructions in a nutshell: 5 cr core course CSM141081
176176
177-
- Do the exercises. The exercises are submitted through GitHub and marking them as done on the [submission system](https://studies.cs.helsinki.fi/stats/courses/fullstackopen).
177+
- Do the exercises. The exercises are submitted through GitHub and marking them is done on the [submission system](https://studies.cs.helsinki.fi/stats/courses/fullstackopen).
178178
- [The course certificate](/en/part0/general_info#course-certificate) will be available in the submission system
179179
- If you want to get University of Helsinki credits
180180
- Enroll in the course. You will get the enrollment link through the submission system once you have completed enough exercises. Read more [here](/en/part0/general_info#submitting-exercises)
@@ -186,7 +186,7 @@ Please note that if you do the "base course" with 6 or 7 credits, you need separ
186186
187187
How to study the course – instructions in a nutshell: other course parts
188188
189-
- Do the exercises. The exercises are submitted through GitHub and marking them as done on the submission system. Note that parts 8-13 have a separate instance in the submission system
189+
- Do the exercises. The exercises are submitted through GitHub and marking them is done on the submission system. Note that parts 8-13 have a separate instance in the submission system
190190
- [The course certificate](/en/part0/general_info#course-certificate) will be available in the submission system
191191
- If you want to get University of Helsinki credits
192192
- Enroll in the course. You can enroll in each part through the link in the course material ([Parts and completion](/en/part0/general_info#parts-and-completion)). Enroll in each part separately.

src/content/1/fi/osa1d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ Konsoli paljastaa ongelman
318318

319319
![](../../images/1/32.png)
320320

321-
Vaikka tilalle _left_ asetettiin uusi arvo kutsumalla _setLeft(left + 1)_ on tilalla siis tapahtumankäsittelijän sisällä edelleen vanha arvo päivityksestä huolimatta! Tämän takia seuraava takia nappien painallusten laskuyritys tuottaa aina yhtä liian pienen tuloksen:
321+
Vaikka tilalle _left_ asetettiin uusi arvo kutsumalla _setLeft(left + 1)_ on tilalla siis tapahtumankäsittelijän sisällä edelleen vanha arvo päivityksestä huolimatta! Tämän takia seuraava nappien painallusten laskuyritys tuottaa aina yhtä liian pienen tuloksen:
322322

323323
```js
324324
setTotal(left + right)

src/content/13/en/part13a.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ postgres=#
156156
```
157157

158158
Defined in this way, the data stored in the database is persisted only as long as the container exists. The data can be preserved by defining a
159-
[volume](/en/part12/building_and_configuring_environments#persisting-data-with-volumes) fort the data, see more
159+
[volume](/en/part12/building_and_configuring_environments#persisting-data-with-volumes) for the data, see more
160160
[here](https://github.com/docker-library/docs/blob/master/postgres/README.md#pgdata).
161161

162162
#### Using the psql console
@@ -781,7 +781,7 @@ Now the result is exactly what we want:
781781
In the case of a collection of objects, the method toJSON does not work directly, the method must be called separately for each object in the collection:
782782

783783
```js
784-
router.get('/', async (req, res) => {
784+
app.get('/api/notes', async (req, res) => {
785785
const notes = await Note.findAll()
786786

787787
console.log(notes.map(n=>n.toJSON())) // highlight-line
@@ -806,7 +806,7 @@ The print looks like the following:
806806
However, perhaps a better solution is to turn the collection into JSON for printing by using the method [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify):
807807

808808
```js
809-
router.get('/', async (req, res) => {
809+
app.get('/api/notes', async (req, res) => {
810810
const notes = await Note.findAll()
811811

812812
console.log(JSON.stringify(notes)) // highlight-line

src/content/13/en/part13c.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,11 @@ module.exports = {
219219
up: async ({ context: queryInterface }) => {
220220
await queryInterface.addColumn('users', 'admin', {
221221
type: DataTypes.BOOLEAN,
222-
default: false
222+
defaultValue: false
223223
})
224224
await queryInterface.addColumn('users', 'disabled', {
225225
type: DataTypes.BOOLEAN,
226-
default: false
226+
defaultValue: false
227227
})
228228
},
229229
down: async ({ context: queryInterface }) => {

src/content/2/en/part2c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ What's not immediately obvious, however, is where the command <em>axios.get</em>
362362

363363
### Effect-hooks
364364

365-
We have already used [state hooks](https://react.dev/learn/state-a-components-memory) that were introduced along with React version [16.8.0](https://www.npmjs.com/package/react/v/16.8.0), which provide state to React components defined as functions - the so-called <i>functional components</i>. Version 16.8.0 also introduces [effect hooks](https://reactjs.org/docs/hooks-effect.html) as a new feature. As per the official docs:
365+
We have already used [state hooks](https://react.dev/learn/state-a-components-memory) that were introduced along with React version [16.8.0](https://www.npmjs.com/package/react/v/16.8.0), which provide state to React components defined as functions - the so-called <i>functional components</i>. Version 16.8.0 also introduces [effect hooks](https://react.dev/reference/react#effect-hooks) as a new feature. As per the official docs:
366366

367367
> <i>The Effect Hook lets you perform side effects on function components.</i>
368368
> <i>Data fetching, setting up a subscription, and manually changing the DOM in React components are all examples of side effects.</i>

src/content/2/en/part2d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ axios.put(url, note).then(response => {
233233
// ...
234234
```
235235
236-
This is not recommended because the variable <em>note</em> is a reference to an item in the <em>notes</em> array in the component's state, and as we recall we must [never mutate state directly](https://reactjs.org/docs/state-and-lifecycle.html#using-state-correctly) in React.
236+
This is not recommended because the variable <em>note</em> is a reference to an item in the <em>notes</em> array in the component's state, and as we recall we must [never mutate state directly](https://react.dev/learn/updating-objects-in-state#why-is-mutating-state-not-recommended-in-react) in React.
237237
238238
It's also worth noting that the new object _changedNote_ is only a so-called [shallow copy](https://en.wikipedia.org/wiki/Object_copying#Shallow_copy), meaning that the values of the new object are the same as the values of the old object. If the values of the old object were objects themselves, then the copied values in the new object would reference the same objects that were in the old object.
239239

src/content/3/en/part3a.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,10 @@ Implement a page at the address <http://localhost:3001/info> that looks roughly
883883
![Screenshot for 3.2](../../images/3/23x.png)
884884

885885
The page has to show the time that the request was received and how many entries are in the phonebook at the time of processing the request.
886+
887+
Proposed Addition: There can only be one response.send() statement in an Express app route. Once you send a response to the client using response.send(), the request-response cycle is complete and no further response can be sent.
888+
889+
To include a line space in the output, use <br/> tag, or wrap the statements in <p> tags.
886890

887891
#### 3.3: Phonebook backend step3
888892

src/content/3/en/part3c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ One way to format the objects returned by Mongoose is to [modify](https://stacko
400400

401401
To modify the method we need to change the configurable options of the schema, options can be changed using the set method of the schema, see here for more info on this method: https://mongoosejs.com/docs/guide.html#options. See <https://mongoosejs.com/docs/guide.html#toJSON> and <https://mongoosejs.com/docs/api.html#document_Document-toObject> for more info on the _toJSON_ option.
402402

403-
see <https://mongoosejs.com/docs/api.html#transform> for more info on the _transform_ function.
403+
see <https://mongoosejs.com/docs/api/document.html#transform> for more info on the _transform_ function.
404404

405405
```js
406406
noteSchema.set('toJSON', {

src/content/3/en/part3d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ When validating an object fails, we return the following default error message f
8585
![postman showing error message](../../images/3/50.png)
8686

8787
We notice that the backend has now a problem: validations are not done when editing a note.
88-
The [documentation](https://github.com/blakehaswell/mongoose-unique-validator#find--updates) explains what is the problem, validations are not run by default when <i>findOneAndUpdate</i> is executed.
88+
The [documentation](https://github.com/blakehaswell/mongoose-unique-validator#find--updates) addresses the issue by explaining that validations are not run by default when <i>findOneAndUpdate</i> is executed.
8989

9090
The fix is easy. Let us also reformulate the route code a bit:
9191

0 commit comments

Comments
 (0)