1
00:00:00,240 --> 00:00:08,520
OK, so this nicely works, we're getting back stats for each user, but there's tiny dewji in our setup.

2
00:00:09,090 --> 00:00:15,750
What do you think is going to happen if the user just sign up for the account?

3
00:00:16,230 --> 00:00:20,970
So essentially there are no jobs or if he or she is not adding the job?

4
00:00:20,990 --> 00:00:28,290
So again, the scenario that I'm trying to represent is if there are no jobs, I know we can clearly

5
00:00:28,290 --> 00:00:29,490
see that with Peter.

6
00:00:30,660 --> 00:00:32,280
That's the other use that I have.

7
00:00:32,580 --> 00:00:36,240
So I'm going to go here with email and I'm going to go with beta Gmail dot com.

8
00:00:36,240 --> 00:00:37,400
The secret a secret.

9
00:00:37,410 --> 00:00:37,690
OK?

10
00:00:37,710 --> 00:00:38,400
That's awesome.

11
00:00:38,730 --> 00:00:42,420
And if I go and show stats, I've got nothing.

12
00:00:43,220 --> 00:00:47,270
And even if I at one job, which definitely we can do.

13
00:00:47,300 --> 00:00:52,600
So let's go here with career job and I'm going to keep the same values just so it's easier.

14
00:00:52,610 --> 00:00:57,320
Yep, we create that, we go, it starts and now we're definitely should have one for banning.

15
00:00:57,680 --> 00:00:58,880
So life is great.

16
00:00:59,210 --> 00:01:03,020
But eventually, this will break our front and application.

17
00:01:03,230 --> 00:01:04,430
That's the problem here.

18
00:01:05,170 --> 00:01:09,950
And technically, you can make an argument that we can set up defaults here on front, then that's a

19
00:01:09,950 --> 00:01:10,640
definite case.

20
00:01:11,000 --> 00:01:18,140
But again, this comes down to preference where I'd rather set up those values on the server on a backhand.

21
00:01:18,560 --> 00:01:22,760
So here's what we're trying to achieve if we take a look at the Redmi.

22
00:01:23,770 --> 00:01:29,260
The next step is going to be following where I'll create default, that object.

23
00:01:29,860 --> 00:01:36,910
I'll pretty much mimic the same properties pending interview and decline, and I'll check if the property

24
00:01:36,910 --> 00:01:44,080
exists in the stats after we have run the reduced awesome use that value, if not, then use zero.

25
00:01:45,030 --> 00:01:51,810
And the goal here is that if the user just logged in or he or she just doesn't have any jobs, at least

26
00:01:51,810 --> 00:01:52,950
we have some kind of values.

27
00:01:53,280 --> 00:01:56,870
So if I work on a front end, at least we can display zeros again.

28
00:01:56,910 --> 00:02:00,310
Yes, we can set up those default ones on a random browser.

29
00:02:00,330 --> 00:02:02,430
Rather do that here in a server.

30
00:02:02,730 --> 00:02:07,170
And we'll also right away add these monthly applications, which will work on next.

31
00:02:07,410 --> 00:02:13,380
As far as the charts, simply because, again, since I'm setting up the whole functionality anyway,

32
00:02:13,800 --> 00:02:18,480
we might as well add this as a dummy value and then we just add the functionality.

33
00:02:18,750 --> 00:02:24,000
So that way, I don't need to go through my whole application just to change this one property, just

34
00:02:24,000 --> 00:02:26,700
like we did in the previous setups.

35
00:02:27,090 --> 00:02:34,620
So let's go to a jobs controller and let's set up that object where effectively we want to go with const

36
00:02:34,950 --> 00:02:40,980
and default starts, and then that one will be equal to an object and then let's go one by one.

37
00:02:41,010 --> 00:02:46,590
So we have one pending that will be equal to a start spending or a zero.

38
00:02:47,070 --> 00:02:49,770
So we'll go here with zero unless copying Parrish.

39
00:02:49,770 --> 00:02:52,500
Let's add those zeros here, meaning comma sorry.

40
00:02:53,070 --> 00:02:56,250
And the second value will be into real.

41
00:02:56,940 --> 00:02:59,730
So let me probably use my two characters here.

42
00:03:00,300 --> 00:03:06,480
So I'm going to go here with Interview, which might be in the stats as appropriate might not.

43
00:03:07,200 --> 00:03:09,870
Then that depends whether the user has created those jobs.

44
00:03:10,290 --> 00:03:17,130
And then we want to go with the combined, let's say that I want, and now it will notice, by the way,

45
00:03:17,370 --> 00:03:24,540
the North is missing over here and no one will notice is the fact that even if Peter doesn't have any

46
00:03:24,540 --> 00:03:26,380
jobs, at least we'll get back to zeros.

47
00:03:26,730 --> 00:03:29,640
Now, let's not forget about those monthly applications.

48
00:03:30,060 --> 00:03:33,960
So let's go here with let and monthly applications.

49
00:03:34,470 --> 00:03:39,990
And yes, again, we're using let because eventually we're off to do more work.

50
00:03:41,000 --> 00:03:45,620
We will use the aggregation pipeline, but we'll have to manipulate the data.

51
00:03:45,830 --> 00:03:53,480
But so let's go here with default starts first and then also pass in those monthly applications.

52
00:03:53,870 --> 00:03:54,860
Let's save it.

53
00:03:54,860 --> 00:04:00,770
And now if I go back to the postman instead of just getting one value, we're going to get at least

54
00:04:00,770 --> 00:04:01,520
some zeroes.

55
00:04:01,650 --> 00:04:05,860
So I'm going to have pending interview and declined and then left me quickly again.

56
00:04:05,880 --> 00:04:10,440
Log in as John, or I'm sorry, I'm logging back here as beta.

57
00:04:10,490 --> 00:04:10,940
My bad.

58
00:04:11,180 --> 00:04:12,410
So let's go here with John.

59
00:04:12,800 --> 00:04:19,339
Let's log in and now see that everything still works as far as our stats.

60
00:04:19,490 --> 00:04:21,500
So now I'm just getting these defaults stats.

61
00:04:22,040 --> 00:04:28,070
But in here, since John does have values, everything is spelled out, and that's how we can set up

62
00:04:28,460 --> 00:04:30,290
the default stats.

63
00:04:30,530 --> 00:04:34,940
So our front end doesn't break if the user hasn't created the jobs.

