Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved feed from Communication to Activity Log #4435

Merged
merged 17 commits into from Nov 21, 2017

Conversation

shreyashah115
Copy link
Contributor

@shreyashah115 shreyashah115 commented Nov 6, 2017

#4233
Summary:

  1. Removed comment_type == Updated from Communication DocType.
  2. New DocType Activity Log, moved feed.py to activity_log.
  3. All the feed types get stored in activity_log.
  4. Display feeds on Activity Page.
  5. Patch added - where all the communication with comment_type == Updated are moved to Activity Log and deleted from Communication, along with the creation date and time.
    screenshot from 2017-11-06 15-26-41

ac

  1. Moved login and logout feeds to Activity Log table.
  2. Added test cases.

Copy link
Member

@rmehta rmehta left a comment

Choose a reason for hiding this comment

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

👍 write a test case that creates an activity log and then checks the query

frappe.reload_doc("core", "doctype", "activity_log")

communication_data = frappe.get_all('Communication', filters= {'comment_type': 'Updated'})
activity_log_field = frappe.get_meta('Activity Log').fields
Copy link
Member

Choose a reason for hiding this comment

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

should be plural

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, will change.

creation = frappe.db.get_value('Communication', {'name': d.name}, 'creation')
modified = frappe.db.get_value('Communication', {'name': d.name}, 'modified')

frappe.db.set_value('Activity Log', activity_doc.name, 'creation', creation)
Copy link
Member

Choose a reason for hiding this comment

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

should be just communication_doc.creation, no need to query again

@shreyashah115
Copy link
Contributor Author

@rmehta Fixed!

activity_doc = frappe.get_doc(activity_data)
activity_doc.insert()

frappe.db.set_value('Activity Log', activity_doc.name, 'creation', communication_doc.creation)
Copy link
Member

Choose a reason for hiding this comment

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

why set_value?

Can't we set creation and modified datetime at the time of activity log creation?

@@ -276,6 +283,11 @@ def delete_dynamic_links(doctype, name):
set timeline_doctype=null, timeline_name=null
where timeline_doctype=%s and timeline_name=%s""", (doctype, name))

# unlink feed
frappe.db.sql("""update `tabActivity Log`
Copy link
Member

Choose a reason for hiding this comment

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

Does doctype, docname changes here?

If no then you can merge Unlink activity log and unlink feed together in single update query

@rmehta rmehta merged commit acdbb97 into frappe:develop Nov 21, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants