Skip to content

Conversation

@MridulS
Copy link
Contributor

@MridulS MridulS commented Jul 22, 2016

Screen after logging in
screen shot 2016-07-22 at 7 04 45 pm
Click on notifications in the nav bar.
screen shot 2016-07-22 at 7 04 53 pm

@adbharadwaj @tmmurali

#no relationship specified

class share_graph_event(Base):
__tablename__ = 'share_graph_event'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some docs on the schema. What does the table store? Why do you need each attribute?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class names should have camel case.

@tmmurali
Copy link
Member

Looks very promising. I added some comments.

On Fri, Jul 22, 2016 at 1:59 PM, Mridul Seth [email protected]
wrote:

Screen after logging in
[image: screen shot 2016-07-22 at 7 04 45 pm]
https://cloud.githubusercontent.com/assets/5363860/17066269/9244a5aa-5046-11e6-96ba-b0f5506cf133.png
Click on notifications in the nav bar.
[image: screen shot 2016-07-22 at 7 04 53 pm]
https://cloud.githubusercontent.com/assets/5363860/17066271/958f8018-5046-11e6-81f6-2dcefcc85596.png

@adbharadwaj https://github.com/adbharadwaj @tmmurali

https://github.com/tmmurali

You can view, comment on, or merge this pull request online at:

#191
Commit Summary

  • Add initial layout for notifications framework
  • Add spec for share graph event db functions
  • Add boilerplate test

File Changes

Patch Links:


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#191, or mute the thread
https://github.com/notifications/unsubscribe-auth/AGkWUBOC8eQHgG475b7Pmpk98kkxm5CJks5qYQT_gaJpZM4JS_ZW
.

graphs/views.py Outdated
context['footer'] = True

return render(request, 'graphs/graphs.html', context)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add python documentation for this method. https://www.python.org/dev/peps/pep-0257/

@adbharadwaj
Copy link
Collaborator

@MridulS, I have updated the master branch with new installation process.

I would like you to fetch your master branch from main repository and update your master branch.
Then merge your master into your branch.
Follow the new installation procedure and let me know if you are facing any problems.

db_session = data_connection.new_session()

# Get the current time
cur_time = datetime.now()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont need this variable. you directly assign the value while creating the share event object.

@adbharadwaj
Copy link
Collaborator

I added some comments. The priority is to get a working demo by Monday meeting though.

@@ -0,0 +1,4 @@
from django.core.exceptions import ObjectDoesNotExist

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to be used anymore.

@MridulS
Copy link
Contributor Author

MridulS commented Aug 5, 2016

@tmmurali @adbharadwaj Updates to the front end.

[email protected] shares 2 graphs in group groupfromuser1 and 3 graphs in group secondgroupofuser1 and [email protected] is part of both the groups.
After logging in with [email protected] and navigating to notifications.
screen shot 2016-08-06 at 4 05 24 am 2

Click on Mark as read for one notification in the first group
screen shot 2016-08-06 at 4 05 29 am 2

Click on Mark all as read for the second group
screen shot 2016-08-06 at 4 05 38 am 2

Click on Mark all notifications as read
screen shot 2016-08-06 at 4 05 46 am 2

Click on groupfromuser1 bar in the left column. This will give all the notifications generated in that group.
screen shot 2016-08-06 at 4 05 49 am 2

Similarly for the second group.
screen shot 2016-08-06 at 4 05 51 am 2

db_session = data_connection.new_session()
try:

events = db_session.query(models.ShareGraphEvent).filter(models.ShareGraphEvent.member_id == member_id).filter(models.ShareGraphEvent.group_id == group_id).all()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use the update api here ?

@adbharadwaj
Copy link
Collaborator

4.1 Notification system

4.1.1 View all notifications flow.

  1. User Request: <host>/<uid>/notifications
  2. Views: notifications method
    1. Controller: get_notifications_for_user(user_id, group_id=None)
      1. DAL: get_share_graph_event_by_member_id()
    2. Controller: Handle exceptions like user doesnt exist or other kinds of database errors. Communicate these errors to view layer so that appropriate messages can be shown to the users.
  3. Views: Construct context for templates.
  4. Views: Render template (notifications.html) and send to user.
  5. User Response: HTML page.

4.1.2 View all notifications for a group.

  1. User Request: <host>/<uid>/notifications?group_id=<group_id>
  2. Views: notifications_method
    1. Controller: get_notifications_for_user(user_id, group_id)
      1. DAL: get_share_graph_event_by_member_id_and_group_id(member_id, group_id)
    2. Controller: Handle exceptions like user/group doesnt exist or user is not a member of the group or other kinds of database errors. Communicate these errors to view layer so that appropriate messages can be shown to the users.
  3. Views: Construct context for templates.
  4. Views: Render template (notifications.html) and send to user.
  5. User Response: HTML page.

4.1.3 Mark one or more notifications as read.

  1. User Action: User clicks on one of the ticks or "mark all as read" button.
  2. Javascript: Catches users action. Fetches the corresponding notification_id(s). Creates the POST request and sends a AJAX request.
  3. AJAX Request: <host>/javascript/<uid>/mark_notifications_as_read/ It will be a POST API request with list of notification ids in the request body.
  4. Views: mark_notifications_as_read_api(user_id, notification_ids).
    1. Controller: mark_notifications_as_read()
      1. DAL: set_share_graph_events_inactive()
    2. Controller: Handle exceptions like user/share_graph_event doesnt exist or other kinds of database errors. Communicate these errors to view layer so that appropriate messages can be shown to the users.
  5. Views: Construct context for JSON response.
  6. Views: Send JSON response to client side javascript.
  7. AJAX Response: Check if the request was successfull. If successfull, then gray up the notification row and remove the tick mark by manipulating the DOM.

@MridulS
Copy link
Contributor Author

MridulS commented Aug 14, 2016

I have made two different User Interfaces right now, one which greys out the notifications as the tick mark button is clicked (you need to refresh to remove those notifications from the screen) and the other one removes the notification from the list of notification on click.

The greying out one:
18xca3

The other one:
18xc6j

The grey one is closer to github but I personally like the second one.

@tmmurali @adbharadwaj Thoughts?

return {'Error': 'No share graph event found.'}


def get_share_graph_event_by_member_id_and_group_id(member_id, group_id):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring required

@MridulS
Copy link
Contributor Author

MridulS commented Aug 17, 2016

@adbharadwaj The left group column uses groups from grouped_notifications.keys() to fetch the groups, if all the notifications are read then it will not be possible to fetch groups for the user so I have added a new controller method get_notifications_group_stats_for_user which fetches all the stats from the db to create the left column in notifications.html


$('[data-toggle="tooltip"]').tooltip();
// grey out notification row and remove the tick mark for notification row
var manipulate_dom = function(notification_ids){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename method name to "grey_out_notifications"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants