Learn Courses My Dashboard

Module 2 Lesson 16 Challenge Problem

I have almost completed this challenge, but I got stuck with the authors page displaying a single author and all his/her quotes only. I then checked out CWC’s solution, and lo and behold Chris’ solution does the same! Has anyone got a properly working solution for this challenge?

Hi @Hannes

Welcome to the Code Crew community.

What exactly is the issue you are referring to? As far as I can tell the project that Chris Ching posted as a solution works fine. The only thing being that the data is exactly the same for each one.

When I run Chris’s solution, you get only one author’s cards, and all the cards on the first list is from the first author, Charles Swindell if I remember correctly. This is not how this is supposed to work. One is supposed to see the first quote of each of the many authors on that first page. So that first page introduces you to all the authors. When selecting a card from an author (with only the first quote on the background image), then a list opens up with all the quotes from that author. In Chris’ solution, you will always get Mr Swindell’s quotes, because all the cards only list his quotes, one quote per card for all his cards. Is this not what you see if you run his solution?

You are right when you say that all the quotes in the solution are from the same author on each card and when you select the card to see the Detail View you see the same quotes each time.

I used different Authors in my version of the App and the quotes are related to those authors so they are different for each card.

In the case of the solution Chris Ching provided he just duplicated the same data in the json file so as a consequence the same author appears everywhere. Here is the json file he used:

[
{
    "name":"Charles Swindoll",
    "quotes":["We are all faced with a series of great opportunities brilliantly disguised as impossible situations.",
        "Each day of our lives we make deposits in the memory banks of our children.",
        "The remarkable thing is, we have a choice everyday regarding the attitude we will embrace for that day.",
    "When you have vision it affects your attitude. Your attitude is optimistic rather than pessimistic."],
    "image":"ambition"
},
{
    "name":"Charles Swindoll",
    "quotes":["We are all faced with a series of great opportunities brilliantly disguised as impossible situations.",
        "Each day of our lives we make deposits in the memory banks of our children.",
        "The remarkable thing is, we have a choice everyday regarding the attitude we will embrace for that day.",
    "When you have vision it affects your attitude. Your attitude is optimistic rather than pessimistic."],
    "image":"calm"
},
{
    "name":"Charles Swindoll",
    "quotes":["We are all faced with a series of great opportunities brilliantly disguised as impossible situations.",
        "Each day of our lives we make deposits in the memory banks of our children.",
        "The remarkable thing is, we have a choice everyday regarding the attitude we will embrace for that day.",
    "When you have vision it affects your attitude. Your attitude is optimistic rather than pessimistic."],
    "image":"focus"
},
{
    "name":"Charles Swindoll",
    "quotes":["We are all faced with a series of great opportunities brilliantly disguised as impossible situations.",
        "Each day of our lives we make deposits in the memory banks of our children.",
        "The remarkable thing is, we have a choice everyday regarding the attitude we will embrace for that day.",
    "When you have vision it affects your attitude. Your attitude is optimistic rather than pessimistic."],
    "image":"reflect"
}

]

I hope you can see the funny side of this.

@Hannes
I assume that your json data has different authors and quotes related to those authors but from what you were alluding to in your original post, are you saying that you are seeing the same Author on every card and therefore the same quotes in each case?

Now I feel like an idiot! I never thought to check his json file! I never thought he would play this funny trick on us! Now I have learned he has a sense of humour! Thanks for the help!

He didn’t play a funny trick on anyone. The intention was an exercise for students to attempt to create their own JSON file and integrate it into their App. It was a time saving exercise on his part to create enough data to have multiple cards visible.