To output more useful information about a single project item.
Let's go to the project.
Item class because that is where we render this and in the year when I set the content of the H free
tack which is dad a number of persons we could changed as to say number of persons which were out putting
here plus a signed so did we at least say if I rendered is five a signed but five assigned all day isn't
really a good wording right now we of course you could say five or whatever the number is persons assigned.
So if we say persons assigned here that is better whips testing test is work because now it is say is
five persons assigned.
Well that's better but it's still not optimal.
What if we only have a project with one person.
It still says persons and that doesn't make too much sense.
Now I gather.
Can help us there.
So instead of saying persons or person here I just say plus assigned but actually don't just one output
the number of people here.
I want to use a getter instead.
Which returns us a proper term.
So the right text basically.
So here I'll add a getter and convention not a must do but a convention you often see is to add getters
and setters right below your observe fields.
So I will add it here below my fields above the constructor.
Now I'll name it persons.
The name is totally up to you.
I'll name it persons here and a getter is basically like a function.
So you have to add parentheses here and then curly braces.
Now in there as you see you must return a value.
And here I want to return value which is basically some text based on the number of people I have in
my project here so you can check if this project people is equal to 1.
In that case I will return one person as a text here.
Else I know it's more than one or zero.
And in both cases I would say persons plural form.
I will return template literal actually simply because it's easier to write a text with injected content
with a template literal and there I'll say this project that people persons.
So now this is the text I return in this scenario.
So now we just have to use this getter to automatically get the right jargon the right text.
So down later instead of reaching out to this project people I will just say this person's assigned
and I exist is like a normal property.
So we're not calling this like a function with parentheses.
Instead we axis is like this but this will trigger this scatter because it is the same name.
So this will trigger the scatter run our logic there and then return the appropriate text.
So now if we try this again testing dust is work and I assign five we see five persons assigned.
Dust is really work for sure and I add one here we see one person assigned.
So now this works in the way I want it to work.
Now it is really outputs this properly and it shows a nice use case of a getter where it just helps
us transform data when we retrieve it.