1
1

00:00:01,530  -->  00:00:03,610
<v Jose>Welcome back, in this video we're going to start</v>
2

2

00:00:03,610  -->  00:00:08,280
looking at the alerts, an alert in our app is going
3

3

00:00:08,280  -->  00:00:12,080
to be the wrapper around the logic that we need
4

4

00:00:12,080  -->  00:00:15,810
in order to notify users when the item that they're
5

5

00:00:15,810  -->  00:00:19,193
interested in has gone under the price that they desire.
6

6

00:00:20,030  -->  00:00:22,980
So what I've written here is a short programme
7

7

00:00:22,980  -->  00:00:26,310
called alert updater, and what this programme is going to do
8

8

00:00:26,310  -->  00:00:29,670
is in general terms it's going to get all the alerts
9

9

00:00:29,670  -->  00:00:31,800
that there are in a database,
10

10

00:00:31,800  -->  00:00:33,290
then it's going to cycle through them,
11

11

00:00:33,290  -->  00:00:37,166
and for each one it's going to find out the item's price
12

12

00:00:37,166  -->  00:00:39,460
and then it's going to send the user an email.
13

13

00:00:39,460  -->  00:00:42,910
Or some mobile notification, or however we want to do it.
14

14

00:00:42,910  -->  00:00:46,730
It's going to notify the user if the price has been reached.
15

15

00:00:46,730  -->  00:00:48,140
That's basically what it's going to do,
16

16

00:00:48,140  -->  00:00:51,760
of course we don't have an alert model, yet.
17

17

00:00:51,760  -->  00:00:53,930
So we do have to go and write it.
18

18

00:00:53,930  -->  00:00:56,780
But this is how I want to be able to interact
19

19

00:00:56,780  -->  00:00:59,010
with the alert, and again this is what you should
20

20

00:00:59,010  -->  00:01:02,660
be thinking first before going and coding the alert model.
21

21

00:01:02,660  -->  00:01:05,910
Think about what you want it to do.
22

22

00:01:05,910  -->  00:01:09,400
So we're gonna be able to load a specific item's price
23

23

00:01:09,400  -->  00:01:13,694
and that item has to be related to the alert somehow
24

24

00:01:13,694  -->  00:01:18,120
as we are not passing item information anywhere around here,
25

25

00:01:18,120  -->  00:01:21,750
and the alert has to be able to notify the user,
26

26

00:01:21,750  -->  00:01:24,670
whoever that is that the price has been reached
27

27

00:01:24,670  -->  00:01:25,943
if it has been reached.
28

28

00:01:26,890  -->  00:01:29,640
Let's go into our models and create a new file
29

29

00:01:29,640  -->  00:01:33,470
that I'm going to call alert, and here we're going to write
30

30

00:01:33,470  -->  00:01:38,470
our alert class, now we're gonna have an init method,
31

31

00:01:39,030  -->  00:01:40,730
we're gonna have a JSON method.
32

32

00:01:40,730  -->  00:01:41,870
We're gonna need this in order
33

33

00:01:41,870  -->  00:01:43,984
to write things to the database,
34

34

00:01:43,984  -->  00:01:48,200
we're gonna have a save to mongo method.
35

35

00:01:48,200  -->  00:01:50,900
Because we do need to be able to save this alert
36

36

00:01:50,900  -->  00:01:54,420
to the database, we're gonna have a class method
37

37

00:01:54,420  -->  00:01:57,620
called all and that's gonna be able to load all
38

38

00:01:57,620  -->  00:02:02,620
of the alerts and then we're going to have a load item price
39

39

00:02:06,810  -->  00:02:08,717
and we're also going to have
40

40

00:02:08,717  -->  00:02:11,633
a notify if price reached method.
41

41

00:02:14,550  -->  00:02:17,060
Now it's up to you whether you want to order these.
42

42

00:02:17,060  -->  00:02:19,660
Normally I recommend putting the class methods
43

43

00:02:19,660  -->  00:02:24,500
at the end just to keep methods of the same type
44

44

00:02:24,500  -->  00:02:27,020
all together and so I think this is gonna look
45

45

00:02:27,020  -->  00:02:30,140
a little bit nicer, and so the next thing to do
46

46

00:02:30,140  -->  00:02:32,250
is to annotate these methods,
47

47

00:02:32,250  -->  00:02:35,310
and define what parameters they're gonna take.
48

48

00:02:35,310  -->  00:02:37,300
That's just gonna help you stay on track
49

49

00:02:37,300  -->  00:02:38,880
with what you want.
50

50

00:02:38,880  -->  00:02:41,360
The JSON method for example is going to return
51

51

00:02:41,360  -->  00:02:45,570
a dictionary because that's what we're gonna use
52

52

00:02:45,570  -->  00:02:49,130
to write things to MongoDB so from typing we're going
53

53

00:02:49,130  -->  00:02:54,130
to import dict, save to Mongo is not gonna return anything
54

54

00:02:54,880  -->  00:02:56,470
and it's not gonna take any arguments.
55

55

00:02:56,470  -->  00:03:00,070
Load item price neither, notify if price reached
56

56

00:03:00,070  -->  00:03:02,563
is not going to do anything.
57

57

00:03:04,090  -->  00:03:08,290
So then we've got this all which is going to be a list,
58

58

00:03:08,290  -->  00:03:10,320
now okay so we do have to import that as well.
59

59

00:03:10,320  -->  00:03:12,700
Actually now that we're here, we might as well do this too
60

60

00:03:12,700  -->  00:03:16,843
for the items so this all method here is going
61

61

00:03:16,843  -->  00:03:17,933
to return a list as well.
62

62

00:03:19,200  -->  00:03:20,033
There we go.
63

63

00:03:21,990  -->  00:03:25,780
Alright so we have the definition of what our methods
64

64

00:03:25,780  -->  00:03:28,550
are going to be like, next step is to start defining
65

65

00:03:28,550  -->  00:03:33,550
the dunder init, an alert has to know a little bit
66

66

00:03:34,380  -->  00:03:39,380
about the item that it is about, so this alert is placed
67

67

00:03:40,060  -->  00:03:44,060
on a specific item so for that we're going to be receiving
68

68

00:03:44,060  -->  00:03:47,110
an item ID which is going to be a string.
69

69

00:03:47,110  -->  00:03:52,080
The item ID is going to be this dunder, sorry not dunder,
70

70

00:03:52,080  -->  00:03:56,430
this underscore ID property of the item.
71

71

00:03:56,430  -->  00:03:59,090
With this underscore ID property we're going to be able
72

72

00:03:59,090  -->  00:04:01,670
to find the item object in the database
73

73

00:04:01,670  -->  00:04:03,623
and actually create an object from it.
74

74

00:04:04,590  -->  00:04:08,350
So we're gonna take in the item ID, then we're also going
75

75

00:04:08,350  -->  00:04:11,860
to have a price limit and that's going to be a float.
76

76

00:04:11,860  -->  00:04:15,810
And what this is going to mean is under which price
77

77

00:04:15,810  -->  00:04:19,180
do we want to send the user a notification
78

78

00:04:19,180  -->  00:04:22,803
that the item has gone under their price that they wanted?
79

79

00:04:24,070  -->  00:04:25,540
And finally we're also going to have
80

80

00:04:25,540  -->  00:04:28,040
an underscore ID property which is going to be a string
81

81

00:04:28,040  -->  00:04:29,740
and it's going to default to none.
82

82

00:04:30,870  -->  00:04:32,610
Alright so now that we have this,
83

83

00:04:32,610  -->  00:04:37,610
we're going to say self.item ID is going to be item id.
84

84

00:04:38,274  -->  00:04:41,723
And the self.item is going to be item get by id.
85

85

00:04:43,000  -->  00:04:47,840
So we're going to actually go and get an item by its ID.
86

86

00:04:47,840  -->  00:04:50,510
Using the item ID we're going to go into the database,
87

87

00:04:50,510  -->  00:04:53,340
we're going to retrieve a specific item
88

88

00:04:53,340  -->  00:04:56,450
and this is going to give us an item object.
89

89

00:04:56,450  -->  00:04:58,080
Not a dictionary,
90

90

00:04:58,080  -->  00:05:01,423
so this is of course something that we do need to create.
91

91

00:05:04,740  -->  00:05:07,370
Okay so this doesn't exist yet, but that's fine
92

92

00:05:07,370  -->  00:05:09,957
we're defining how we want to interact with it
93

93

00:05:09,957  -->  00:05:12,563
and we can go on and create that method in a moment.
94

94

00:05:13,800  -->  00:05:17,370
Then the price limit is gonna be price limit
95

95

00:05:18,570  -->  00:05:23,570
and the collection is going to be alerts
96

96

00:05:23,860  -->  00:05:28,223
and finally the ID is going to be ID or uuid.uuid4 hex
97

97

00:05:30,300  -->  00:05:32,343
and we do have to import that as well.
98

98

00:05:36,180  -->  00:05:41,180
Alright so now we have the dunder init defined,
99

99

00:05:41,320  -->  00:05:44,480
we just have to go and create this get by ID
100

100

00:05:44,480  -->  00:05:46,360
which is going to be fairly straightforward,
101

101

00:05:46,360  -->  00:05:49,070
it's going to be fairly similar to this all method here
102

102

00:05:49,070  -->  00:05:53,030
and by the way, now that we're here I'm going to move this
103

103

00:05:53,030  -->  00:05:55,430
down there as well just to keep the consistency.
104

104

00:05:57,500  -->  00:06:01,610
There we go, so this is the find by ID method definition
105

105

00:06:01,610  -->  00:06:06,390
all that it has to do is go and find the item JSON
106

106

00:06:06,390  -->  00:06:10,830
in the database, database.find one in the items collection
107

107

00:06:10,830  -->  00:06:14,683
and the query is going to be ID is ID,
108

108

00:06:18,040  -->  00:06:23,040
and then return a CLS of that, it returns an item object
109

109

00:06:23,100  -->  00:06:27,920
made with the contents of the thing that was found
110

110

00:06:27,920  -->  00:06:30,870
in a database, notice how in the database we have this
111

111

00:06:30,870  -->  00:06:33,610
find one method, this doesn't exist yet.
112

112

00:06:33,610  -->  00:06:36,377
But all it's gonna do is go into the database
113

113

00:06:36,377  -->  00:06:40,860
and just retrieve the first item that matches
114

114

00:06:40,860  -->  00:06:44,730
this query, because the underscore ID property
115

115

00:06:44,730  -->  00:06:48,150
is unique in MongoDB then we know that there's ever
116

116

00:06:48,150  -->  00:06:50,980
only going to be one item that matches this property.
117

117

00:06:50,980  -->  00:06:53,700
So we can just retrieve that one,
118

118

00:06:53,700  -->  00:06:55,250
and the difference between find
119

119

00:06:56,167  -->  00:06:58,800
and find one is that find returns a cursor.
120

120

00:06:58,800  -->  00:07:01,560
Something that you can iterate over and use a for loop.
121

121

00:07:01,560  -->  00:07:04,660
Find one is just going to return a dictionary,
122

122

00:07:04,660  -->  00:07:06,940
so we can then turn that dictionary
123

123

00:07:06,940  -->  00:07:10,083
into an item object very easily.
124

124

00:07:11,770  -->  00:07:14,370
Okay, so we can go into the database.py
125

125

00:07:14,370  -->  00:07:18,710
and define the find one, again almost the same
126

126

00:07:18,710  -->  00:07:21,380
as the rest of the things we have here.
127

127

00:07:21,380  -->  00:07:23,590
Only it returns a dictionary so we're going to say
128

128

00:07:23,590  -->  00:07:28,590
return database database, collection, find one, query
129

129

00:07:30,730  -->  00:07:35,730
and the insert and find one methods are defined
130

130

00:07:36,350  -->  00:07:41,090
in PyMongo so it is the collection object
131

131

00:07:41,090  -->  00:07:44,550
in PyMongo that has these properties that we're calling,
132

132

00:07:44,550  -->  00:07:47,040
so really we're just calling the same thing that
133

133

00:07:47,040  -->  00:07:50,140
we are receiving here the insert method
134

134

00:07:50,140  -->  00:07:53,720
in our database class calls the insert method in PyMongo.
135

135

00:07:53,720  -->  00:07:55,320
The find method in our database class
136

136

00:07:55,320  -->  00:07:57,230
calls the find method in PyMongo,
137

137

00:07:57,230  -->  00:07:59,910
it's just for our convenience so that we don't have
138

138

00:07:59,910  -->  00:08:01,740
to keep track of this database object
139

139

00:08:01,740  -->  00:08:02,900
all around our programme.
140

140

00:08:02,900  -->  00:08:04,870
We can just call our database class,
141

141

00:08:04,870  -->  00:08:07,758
it just makes things a little bit simpler,
142

142

00:08:07,758  -->  00:08:10,290
and that's what that find by ID is going to do,
143

143

00:08:10,290  -->  00:08:13,330
just find that single item, return the JSON
144

144

00:08:13,330  -->  00:08:15,203
and turn it into a class.
145

145

00:08:16,573  -->  00:08:21,573
Okay, so now that we have that we are, oh sorry.
146

146

00:08:21,770  -->  00:08:24,890
Find by ID should be called get by ID my apologies,
147

147

00:08:24,890  -->  00:08:26,500
just to match that name here.
148

148

00:08:26,500  -->  00:08:29,020
We have the get by ID property there.
149

149

00:08:29,020  -->  00:08:32,093
Now we can begin work on the JSON method of the alert,
150

150

00:08:33,060  -->  00:08:34,970
and this is going to return all of the things
151

151

00:08:34,970  -->  00:08:38,963
that we would like to save to MongoDB for an alert.
152

152

00:08:38,963  -->  00:08:41,403
It's going to be the underscore ID,
153

153

00:08:42,750  -->  00:08:46,090
it's going to be the price limit that we do need to save
154

154

00:08:46,990  -->  00:08:48,823
and it's going to be the item ID.
155

155

00:08:50,390  -->  00:08:52,620
We don't need anything else because in order to create
156

156

00:08:52,620  -->  00:08:55,460
a new alert we just need these three properties.
157

157

00:08:55,460  -->  00:08:58,170
With the item ID we then go and search for an item,
158

158

00:08:58,170  -->  00:09:01,680
the price limit and the ID, collection is hard coded
159

159

00:09:01,680  -->  00:09:03,460
so we don't need to save it to the database,
160

160

00:09:03,460  -->  00:09:05,360
because it's always gonna be the same.
161

161

00:09:06,530  -->  00:09:09,450
To save to Mongo very straightforward,
162

162

00:09:09,450  -->  00:09:13,200
just the same as the item database insert self.collection
163

163

00:09:13,200  -->  00:09:17,560
and self.JSON, do make sure to call the JSON method there
164

164

00:09:17,560  -->  00:09:21,630
don't do this as that will try to save the JSON method
165

165

00:09:21,630  -->  00:09:24,410
to the database, not the output of the JSON method.
166

166

00:09:24,410  -->  00:09:27,700
It's a popular typo there,
167

167

00:09:27,700  -->  00:09:31,863
and we do have to import the database of course.
168

168

00:09:32,900  -->  00:09:34,470
I hope I'm not going too quickly.
169

169

00:09:34,470  -->  00:09:36,830
But this is basically the same that we did
170

170

00:09:36,830  -->  00:09:39,770
in the item model but for the alert,
171

171

00:09:39,770  -->  00:09:41,420
so just the define the properties.
172

172

00:09:41,420  -->  00:09:43,850
Define the representation that we want to save
173

173

00:09:43,850  -->  00:09:46,260
and then define the save to mongo.
174

174

00:09:46,260  -->  00:09:47,840
Now we're going to slow down a little bit
175

175

00:09:47,840  -->  00:09:50,370
as we work on the load item price.
176

176

00:09:50,370  -->  00:09:51,975
What does this have to do?
177

177

00:09:51,975  -->  00:09:56,930
Well it has to go to the item object that we have defined,
178

178

00:09:56,930  -->  00:10:01,930
self.item and make it load the price.
179

179

00:10:02,740  -->  00:10:05,098
So make it actually go to the website
180

180

00:10:05,098  -->  00:10:08,090
and load the price that it has stored
181

181

00:10:09,530  -->  00:10:12,570
and then it just has to return that
182

182

00:10:12,570  -->  00:10:14,930
or let us use that somehow.
183

183

00:10:14,930  -->  00:10:18,330
So we're going to say self.item.load price
184

184

00:10:18,330  -->  00:10:21,520
this is one of the benefits, one of the main benefits
185

185

00:10:21,520  -->  00:10:26,040
of having object in your properties there.
186

186

00:10:26,040  -->  00:10:28,310
Having this item object just lets you call
187

187

00:10:28,310  -->  00:10:30,730
the method you don't have to do any magic
188

188

00:10:30,730  -->  00:10:33,830
or rewrite the code or anything like that.
189

189

00:10:33,830  -->  00:10:37,010
All of that logic related to getting the price
190

190

00:10:37,010  -->  00:10:39,910
is encapsulated in the item model
191

191

00:10:39,910  -->  00:10:43,490
and the alert doesn't really have to know anything about it.
192

192

00:10:43,490  -->  00:10:46,917
Now I'm gonna make this actually return the price,
193

193

00:10:46,917  -->  00:10:50,970
just to make things a little bit simpler,
194

194

00:10:50,970  -->  00:10:54,100
for the caller whoever wants to interact with this method
195

195

00:10:54,100  -->  00:10:57,550
they can either load it and then access the item
196

196

00:10:57,550  -->  00:11:00,280
or they can load it and then they just get the price back.
197

197

00:11:00,280  -->  00:11:02,800
Either will work and this can make things
198

198

00:11:02,800  -->  00:11:04,250
a little bit easier for them,
199

199

00:11:05,550  -->  00:11:08,180
and finally we're gonna work on the notify if price reached.
200

200

00:11:08,180  -->  00:11:11,450
So for now we're not going to be sending emails.
201

201

00:11:11,450  -->  00:11:13,750
Later on in the course we will be sending emails
202

202

00:11:13,750  -->  00:11:18,083
so it will definitely be something we will be working on.
203

203

00:11:19,010  -->  00:11:21,230
Later on the course we will be sending emails
204

204

00:11:21,230  -->  00:11:24,010
so we will learn about that in due course,
205

205

00:11:24,010  -->  00:11:27,175
but for now all I was going to do is if the item price
206

206

00:11:27,175  -->  00:11:31,672
is less than the price limit then it's going to print
207

207

00:11:31,672  -->  00:11:36,672
that the item has reached the appropriate price.
208

208

00:11:47,520  -->  00:11:49,710
So as you can see using an F string makes things
209

209

00:11:49,710  -->  00:11:53,230
quite straight forward, you can just embed things
210

210

00:11:53,230  -->  00:11:56,210
directly into the string and they will be replaced
211

211

00:11:56,210  -->  00:12:00,163
by the value of the variable, when this evaluates.
212

212

00:12:01,320  -->  00:12:04,990
For the all method, same thing as the item.
213

213

00:12:04,990  -->  00:12:08,083
So we're gonna take this here,
214

214

00:12:09,780  -->  00:12:12,040
and we're just gonna do the exact same but instead
215

215

00:12:12,040  -->  00:12:15,200
of items from DB it's gonna be alerts from DB
216

216

00:12:15,200  -->  00:12:18,400
and instead of item it's gonna be cls,
217

217

00:12:18,400  -->  00:12:20,603
and instead of this it's gonna be that.
218

218

00:12:24,490  -->  00:12:28,250
So exactly the same which does remind me that I forgot
219

219

00:12:28,250  -->  00:12:31,630
to use cls there, same thing item or cls
220

220

00:12:31,630  -->  00:12:33,970
but of course now in the alert class,
221

221

00:12:33,970  -->  00:12:38,060
cls means the alert class not item.
222

222

00:12:38,060  -->  00:12:40,600
Because the cls means the current class
223

223

00:12:40,600  -->  00:12:44,630
that is being called when you call this method.
224

224

00:12:44,630  -->  00:12:47,630
So exactly the same code, just changing over the names
225

225

00:12:47,630  -->  00:12:49,920
and the collection that we're finding things in,
226

226

00:12:49,920  -->  00:12:54,213
gonna give us a set of alert objects.
227

227

00:12:56,070  -->  00:12:59,913
Okay, so we have everything we need.
228

228

00:13:02,020  -->  00:13:06,800
We okay, so we have everything we need,
229

229

00:13:06,800  -->  00:13:09,740
we can go back to our alert updater
230

230

00:13:09,740  -->  00:13:12,040
and we can run it and see what happens.
231

231

00:13:12,040  -->  00:13:12,890
Let's press play.
232

232

00:13:14,140  -->  00:13:16,120
This is a very common issue that I just did
233

233

00:13:16,120  -->  00:13:20,630
a lot of machines do this, notice that nothing happened,
234

234

00:13:20,630  -->  00:13:23,660
and that's because I am running app.py
235

235

00:13:23,660  -->  00:13:27,160
and this is alert updater.py do make sure that
236

236

00:13:27,160  -->  00:13:28,680
when you're running a different file
237

237

00:13:28,680  -->  00:13:31,230
or if something happens that you didn't expect.
238

238

00:13:31,230  -->  00:13:32,980
Make sure you're running the correct file,
239

239

00:13:32,980  -->  00:13:35,623
so right click alert updater and press Run.
240

240

00:13:37,400  -->  00:13:40,500
Okay so it says no alerts have been created,
241

241

00:13:40,500  -->  00:13:42,350
that's because I've got an if statement down here
242

242

00:13:42,350  -->  00:13:44,260
that says if there are no alerts,
243

243

00:13:44,260  -->  00:13:45,840
print that there are no alerts
244

244

00:13:45,840  -->  00:13:47,840
and they are not wrong, we have not added any alerts
245

245

00:13:47,840  -->  00:13:50,310
so we're gonna do that first.
246

246

00:13:50,310  -->  00:13:52,980
The way we're gonna do that is we're just gonna say from,
247

247

00:13:52,980  -->  00:13:56,880
models.alert import alert and then we're gonna say
248

248

00:13:56,880  -->  00:14:00,650
alert equals alert and we do have to pass in
249

249

00:14:01,548  -->  00:14:04,220
an item ID and a price limit.
250

250

00:14:04,220  -->  00:14:09,040
So the item ID we can find it in MongoDB,
251

251

00:14:09,040  -->  00:14:14,040
for example this one, and the price limit is gonna be 1,000
252

252

00:14:16,100  -->  00:14:20,773
or maybe 2,000 just so actually we get something.
253

253

00:14:21,840  -->  00:14:26,840
Save that to MongoDB, run app.py in order to save that,
254

254

00:14:28,650  -->  00:14:31,000
and now we can go back to running alert updater
255

255

00:14:31,870  -->  00:14:34,570
and you can see that we get back our string.
256

256

00:14:34,570  -->  00:14:38,660
The item this one, has reached the price under 2,000.
257

257

00:14:38,660  -->  00:14:43,660
Latest price is 1,469.0 this may not be the best
258

258

00:14:44,030  -->  00:14:45,630
string in the world, you can play around with it,
259

259

00:14:45,630  -->  00:14:47,340
you can change it however you like.
260

260

00:14:47,340  -->  00:14:50,980
But as you can see, we do get the information
261

261

00:14:50,980  -->  00:14:53,710
that we were after, which is that we know when
262

262

00:14:53,710  -->  00:14:57,220
we run this alert updater that the item has
263

263

00:14:57,220  -->  00:14:59,130
reached the price we wanted.
264

264

00:14:59,130  -->  00:15:01,660
So you can see how this would be useful for you
265

265

00:15:01,660  -->  00:15:03,810
as an individual like the developer.
266

266

00:15:03,810  -->  00:15:05,700
Because there is no way of communicating
267

267

00:15:05,700  -->  00:15:08,660
to any other users for now, you actually have to run
268

268

00:15:08,660  -->  00:15:11,910
the programme and look at the console to get an output
269

269

00:15:11,910  -->  00:15:15,550
but even that, is already kinda useful.
270

270

00:15:15,550  -->  00:15:17,960
When we start sending emails,
271

271

00:15:17,960  -->  00:15:20,900
and when we allow our users to go into the website
272

272

00:15:20,900  -->  00:15:23,820
and add their own items and their own alerts
273

273

00:15:23,820  -->  00:15:26,320
that's going to be pretty amazing.
274

274

00:15:26,320  -->  00:15:28,558
It's going to let them keep track of their items
275

275

00:15:28,558  -->  00:15:30,883
whenever and wherever.
276

276

00:15:32,520  -->  00:15:35,980
In addition whenever we run this alert updater,
277

277

00:15:35,980  -->  00:15:38,340
they will be able to get our notification
278

278

00:15:38,340  -->  00:15:40,610
and depending on how often we do that.
279

279

00:15:40,610  -->  00:15:43,720
Then this will be more accurate or less,
280

280

00:15:43,720  -->  00:15:45,940
and what I mean by that is if we run the alert updater
281

281

00:15:45,940  -->  00:15:49,170
ever minute then they will find out about
282

282

00:15:49,170  -->  00:15:54,050
the price change pretty rapidly after the price has changed.
283

283

00:15:54,050  -->  00:15:58,233
If we run it every day they might miss some flash sales.
284

284

00:15:59,120  -->  00:16:01,570
However if we run it every minute they may get
285

285

00:16:01,570  -->  00:16:04,510
an email every minute, that may not be what we want.
286

286

00:16:04,510  -->  00:16:08,070
So these is gonna be a bit of compromise there
287

287

00:16:08,070  -->  00:16:10,930
that we'll have to make in order to have
288

288

00:16:10,930  -->  00:16:12,963
the right frequency for alerts.
289

289

00:16:13,990  -->  00:16:17,420
Of course, you can do a lot of intelligent stuff
290

290

00:16:17,420  -->  00:16:19,650
with something like this in order to not
291

291

00:16:19,650  -->  00:16:21,780
notify users that have already been notified,
292

292

00:16:21,780  -->  00:16:25,560
and so on and so forth but we're not gonna get into that
293

293

00:16:25,560  -->  00:16:27,423
much complexity in this app.
294

294

00:16:28,570  -->  00:16:30,640
Anyway, I'm rambling on so thanks for joining me,
295

295

00:16:30,640  -->  00:16:33,760
I hope you're excited for the next steps in this app
296

296

00:16:33,760  -->  00:16:35,510
and I'll see you in the next video.
