mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 22:19:18 +00:00
feat: Track Youtube interactions via Video DocType
This commit is contained in:
0
erpnext/utilities/report/__init__.py
Normal file
0
erpnext/utilities/report/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
/* eslint-disable */
|
||||
|
||||
frappe.query_reports["YouTube Interactions"] = {
|
||||
"filters": [
|
||||
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"creation": "2020-08-02 05:05:00.457093",
|
||||
"disable_prepared_report": 0,
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2020-08-02 05:05:00.457093",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Utilities",
|
||||
"name": "YouTube Interactions",
|
||||
"owner": "Administrator",
|
||||
"prepared_report": 0,
|
||||
"ref_doctype": "Video",
|
||||
"report_name": "YouTube Interactions",
|
||||
"report_type": "Script Report",
|
||||
"roles": [
|
||||
{
|
||||
"role": "All"
|
||||
},
|
||||
{
|
||||
"role": "System Manager"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
def execute(filters=None):
|
||||
columns = get_columns()
|
||||
data = get_data()
|
||||
return columns, data
|
||||
|
||||
def get_columns():
|
||||
return [
|
||||
{
|
||||
"label": _("Published Date"),
|
||||
"fieldname": "publish_date",
|
||||
"fieldtype": "Date",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Title"),
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Provider"),
|
||||
"fieldname": "provider",
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Views"),
|
||||
"fieldname": "view_count",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Likes"),
|
||||
"fieldname": "like_count",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Dislikes"),
|
||||
"fieldname": "dislike_count",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Views"),
|
||||
"fieldname": "view_count",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Like:Dislike Ratio"),
|
||||
"fieldname": "ratio",
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
}
|
||||
]
|
||||
|
||||
def get_data():
|
||||
return frappe.db.sql("""
|
||||
SELECT
|
||||
publish_date, title, provider,
|
||||
view_count, like_count, dislike_count, comment_count
|
||||
FROM `tabVideo`
|
||||
WHERE view_count is not null
|
||||
ORDER BY view_count desc""")
|
||||
Reference in New Issue
Block a user