1 00:00:00,510 --> 00:00:06,240 There are two last remaining small tasks we have to take care of around processing feedback on surveys. 2 00:00:06,270 --> 00:00:12,960 First we need to make sure that we implement this last responded at date whenever we update a schema. 3 00:00:12,960 --> 00:00:14,620 Now this is going to be pretty straightforward. 4 00:00:14,760 --> 00:00:17,360 So I'm going to flip back over to our route handler. 5 00:00:17,550 --> 00:00:22,140 Here is our query where we attempt to update the one particular survey. 6 00:00:22,470 --> 00:00:26,770 And down inside of our update criteria object right here. 7 00:00:26,790 --> 00:00:28,420 So this is our update criteria. 8 00:00:28,560 --> 00:00:30,860 We're going to add on one more key value pair. 9 00:00:30,900 --> 00:00:38,750 We're going to say also update the last responded property and set it to the new date like so. 10 00:00:38,920 --> 00:00:41,030 So pretty straightforward not too bad. 11 00:00:41,400 --> 00:00:44,190 Now I'd said there was one other thing we need to take care of as well. 12 00:00:44,220 --> 00:00:47,730 If you recall at present we scroll up a little bit. 13 00:00:47,730 --> 00:00:52,500 We were sending back a little thank you message to any user who voted on one of our surveys. 14 00:00:52,590 --> 00:00:58,380 But right now that is broken and so users are seeing a 404 response whenever they click on a link inside 15 00:00:58,380 --> 00:00:59,460 of an email. 16 00:00:59,460 --> 00:01:01,470 So we can easily fix the thing up right here. 17 00:01:01,620 --> 00:01:06,170 The only tricky part is that you need to remember that now whenever a user clicks on a route they're 18 00:01:06,180 --> 00:01:12,120 going to be sent to a route that looks a little something like this something of API slash surveys. 19 00:01:12,300 --> 00:01:14,880 Colon survey ID colon choice. 20 00:01:15,060 --> 00:01:20,550 And so we need to make sure that we kind of encode these wildcards inside of this link as well. 21 00:01:20,550 --> 00:01:29,430 So we're going to say that whenever someone goes to API slash surveys slash colon survey ID slash colon 22 00:01:29,430 --> 00:01:34,440 choice still send them the message back of thanks for voting. 23 00:01:34,440 --> 00:01:39,720 So whenever we are putting together express route handlers and we want to go in some wild card we treated 24 00:01:39,720 --> 00:01:42,940 just the same way we did with this path handler down here. 25 00:01:43,020 --> 00:01:48,300 You put down a colon and then some property name or some variable name whatever you want it to be and 26 00:01:48,300 --> 00:01:53,120 then express will try to greedily match that against incoming requests. 27 00:01:53,130 --> 00:01:55,170 So let's now test this stuff out. 28 00:01:55,170 --> 00:01:56,780 I'm going to save this. 29 00:01:56,970 --> 00:02:03,720 I will flip back over to my browser and I'm going to use the same e-mail that I did before. 30 00:02:03,720 --> 00:02:09,030 So when I click on yes on here and when I do you'll see that we are again shown the message. 31 00:02:09,030 --> 00:02:10,310 Thanks for voting. 32 00:02:10,470 --> 00:02:12,010 Now just to save us a little bit of time. 33 00:02:12,030 --> 00:02:16,760 I also already went through and tested out the last responded at data as well. 34 00:02:16,770 --> 00:02:21,990 So if you want to test that you will need to make sure that you send yourself a new survey because you 35 00:02:21,990 --> 00:02:26,380 have already probably used up the survey that we created for a super final test. 36 00:02:26,400 --> 00:02:30,640 And so you will not be able to make another response because you've already used this link once before. 37 00:02:30,660 --> 00:02:32,040 You've already voted on the survey. 38 00:02:32,310 --> 00:02:37,260 So you might want to create a new survey over here and send it to yourself to test the last updated 39 00:02:37,260 --> 00:02:39,210 at Flag or time stamp. 40 00:02:39,280 --> 00:02:44,820 But like I said I already tested out ahead of time so we didn't have to take more time to check it out. 41 00:02:44,850 --> 00:02:48,820 So I'm looking at the very particular document again of super final test. 42 00:02:49,080 --> 00:02:54,780 And if I scroll down towards the bottom I should now see last responded with the date of basically now 43 00:02:54,900 --> 00:02:56,230 on here as well. 44 00:02:56,250 --> 00:03:02,490 Now one one other quick tip if you want to not have to constantly send yourself new surveys you can 45 00:03:02,490 --> 00:03:07,800 always find your personal e-mail right here that you are testing off of and you can just manually change 46 00:03:07,800 --> 00:03:14,160 the responded flag over to a false go down towards the bottom of the document and click on Save and 47 00:03:14,160 --> 00:03:15,170 go back. 48 00:03:15,510 --> 00:03:21,680 So now your e-mail is recorded as not having given feedback on that particular survey before. 49 00:03:21,870 --> 00:03:26,710 So I could go back over and reuse the same survey again by clicking on yes. 50 00:03:27,060 --> 00:03:32,190 Again just a little tip that you might want to try to use if you want to do some very rapid fire testing 51 00:03:32,400 --> 00:03:37,100 without having to always go back and do another survey creation. 52 00:03:37,620 --> 00:03:37,960 OK. 53 00:03:37,980 --> 00:03:42,350 So I think that pretty much wraps up collecting feedback around surveys. 54 00:03:42,360 --> 00:03:45,590 I can't really think of anything else we need to really need to do around this. 55 00:03:45,780 --> 00:03:47,540 So I do want to take a quick break now. 56 00:03:47,730 --> 00:03:51,870 And I had mentioned that I was going to show you a couple of little tips around putting together queries 57 00:03:52,110 --> 00:03:54,430 to work with Mongoose and Lango DVH. 58 00:03:54,570 --> 00:03:58,800 So let's take a quick pause and then I'll show you some of those tips inside the next section so I'll 59 00:03:58,800 --> 00:04:00,720 see you in just a minute.