DRDD2016 / app

0 stars 1 forks source link

Addingnotefield #240

Closed sohilpandya closed 8 years ago

sohilpandya commented 8 years ago

@minaorangina chaged it.

sohilpandya commented 8 years ago

@minaorangina made the changes.

minaorangina commented 8 years ago

@sohilpandya Just had a read through the code, a couple of points:

sohilpandya commented 8 years ago

@minaorangina

1 - We are getting the request from the param payload, so it will not break. 2 - I'll look into it and delete the sets. 3 - Yes, remember the bug, will make the change and make it similar to setHostEventChoices/getRSVPs, although does the delete ones need to be synchronous or can we keep it as is? In the other places we are setting things into the db, here we are just deleting it.

minaorangina commented 8 years ago

@sohilpandya Regarding point 1: I don't follow - when you say "request from param payload", do you mean the eventID is in the request payload? If so, that's all fine, but surely when getEvent executes on line 22, there wouldn't be an event in the database to get anymore, and the response from the database would always be 0?

Point 3: Deleting is fine - it only happens once and has a callback, so we don't have to worry about returning too early. It's when these asynchronous calls need to run more than once that problems might occur

sohilpandya commented 8 years ago

@minaorangina Ahh, I see the issue re. point 1 now. 😨

I'll swap them so that we fetch the event first and then delete the event.

minaorangina commented 8 years ago

@sohilpandya Before fixing, you might want to start off by writing a failing test for it. Obviously your tests passed in order for you to be able to make the PR in the first place, but really we want to make sure our tests are covering for things like this. Important to be able to really trust our server-side code! 😄

minaorangina commented 8 years ago

@sohilpandya Take a look at https://github.com/DRDD2016/app/issues/168, I outlined all the different things to keep in mind in order to satisfy this user story. Treat it as a checklist if you like, there's quite a few bits to remember to do

sohilpandya commented 8 years ago

@minaorangina in #168 you talk about notifications and adding a field in notifications isCancelled But we decided that we are not creating notifications for events that are deleted.

minaorangina commented 8 years ago

@sohilpandya I remember us discussing that, but I don't remember why we came to that conclusion. Maybe we thought it would be a large step, but as I see it now it seems like it's just a matter of adding that isCancelled flag. I think the improvement to the UX is significant enough to go for it. What do you reckon?

sohilpandya commented 8 years ago

@minaorangina I am not sure about this actually.

I don't think we should add another notification for this, an actual addition in the future maybe to delete all the related notifications from the feed view. At the moment, once the event is deleted and they select the event from the notification feed, they will be taken to a page which says the event has been deleted.

Not sure.

minaorangina commented 8 years ago

@sohilpandya, removing all the previous notifications is definitely not happening at this time, as that would require a fair amount of heavylifting. But at a glance, a user would have no idea if an event has been deleted or not until they click it (if they click it). I reckon adding the notification is a good compromise, and doesn't require too much of a change.

It would be ideal to implement it now, as we don't want sprint 2 hanging over our heads. But if you prefer, raise an issue and have a think about it if you like.

I'm heading out now, I'll be around for merging etc tomorrow morning :+1:

sohilpandya commented 8 years ago

@minaorangina I have made all the changes except for the notifications when the event is deleted.

I have created an issue, we can look into it on tuesday, there are quite a few changes that will need to be made in order to accomodate the new isCancelled field, so we could probably add the other additional fields we need to add to the notifications at the same time. i.e. hasRSVP'd, hasEdited etc.

minaorangina commented 8 years ago

Still can't merge yet @sohilpandya. There's a few things:

Function naming

deleteEventFromCalendar and deleteEventFromUserCalendar are very similar names. It's hard for me to know what the difference is between these two functions at a glance. Let's look at this:

Testing

deleteEventFromCalendar.js

endpoints.js

initDB.js

I'd really recommend using failing tests as your starting point. There's loads going on with this user story and easy for bugs to creep in. If you go test-first here, you have 100% proof that everything is fine and working well 😊

minaorangina commented 8 years ago

👌