Merge branch 'develop' into bom-item-fix

This commit is contained in:
Shivam Mishra 2019-06-13 16:17:54 +05:30 committed by GitHub
commit 4def9836e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
220 changed files with 4408 additions and 9356 deletions

View File

@ -0,0 +1,18 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'bank',
'transactions': [
{
'label': _('Bank Deatils'),
'items': ['Bank Account', 'Bank Guarantee']
},
{
'items': ['Payment Order']
}
]
}

View File

@ -0,0 +1,30 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'bank_account',
'non_standard_fieldnames': {
'Customer': 'default_bank_account',
'Supplier': 'default_bank_account',
'Journal Entry': 'bank_account_no'
},
'transactions': [
{
'label': _('Payments'),
'items': ['Payment Entry', 'Payment Request', 'Payment Order']
},
{
'label': _('Party'),
'items': ['Customer', 'Supplier']
},
{
'items': ['Bank Guarantee']
},
{
'items': ['Journal Entry']
}
]
}

View File

@ -0,0 +1,15 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'cost_center',
'reports': [
{
'label': _('Reports'),
'items': ['Budget Variance Report', 'General Ledger']
}
]
}

View File

@ -0,0 +1,25 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'finance_book',
'non_standard_fieldnames': {
'Asset': 'default_finance_book',
'Company': 'default_finance_book'
},
'transactions': [
{
'label': _('Assets'),
'items': ['Asset', 'Asset Value Adjustment']
},
{
'items': ['Company']
},
{
'items': ['Journal Entry']
}
]
}

View File

@ -0,0 +1,23 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'fiscal_year',
'transactions': [
{
'label': _('Budgets'),
'items': ['Budget']
},
{
'label': _('References'),
'items': ['Period Closing Voucher', 'Request for Quotation', 'Tax Withholding Category']
},
{
'label': _('Target Details'),
'items': ['Sales Person', 'Sales Partner', 'Territory', 'Monthly Distribution']
}
]
}

View File

@ -0,0 +1,26 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'item_tax_template',
'transactions': [
{
'label': _('Pre Sales'),
'items': ['Quotation', 'Supplier Quotation']
},
{
'label': _('Sales'),
'items': ['Sales Invoice', 'Sales Order', 'Delivery Note']
},
{
'label': _('Purchase'),
'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt']
},
{
'items': ['Item']
}
]
}

View File

@ -25,13 +25,13 @@ frappe.ui.form.on("Journal Entry", {
"group_by_voucher": 0
};
frappe.set_route("query-report", "General Ledger");
}, "fa fa-table");
}, __('View'));
}
if(frm.doc.docstatus==1) {
frm.add_custom_button(__('Reverse Journal Entry'), function() {
return erpnext.journal_entry.reverse_journal_entry(frm);
});
}, __('Make'));
}
if (frm.doc.__islocal) {
@ -47,8 +47,7 @@ frappe.ui.form.on("Journal Entry", {
frm.add_custom_button(__("Create Inter Company Journal Entry"),
function() {
frm.trigger("make_inter_company_journal_entry");
}
);
}, __('Make'));
}
},

View File

@ -458,8 +458,9 @@ class JournalEntry(AccountsController):
pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
"customer_name" if d.party_type=="Customer" else "supplier_name")
party_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
party_account_currency = d.account_currency
if pay_to_recd_from and pay_to_recd_from == d.party:
party_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
party_account_currency = d.account_currency
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
bank_amount += (d.debit_in_account_currency or d.credit_in_account_currency)

View File

@ -0,0 +1,14 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'loyalty_program',
'transactions': [
{
'items': ['Sales Invoice', 'Customer']
}
]
}

View File

@ -0,0 +1,23 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'monthly_distribution',
'non_standard_fieldnames': {
'Sales Person': 'distribution_id',
'Territory': 'distribution_id',
'Sales Partner': 'distribution_id',
},
'transactions': [
{
'label': _('Target Details'),
'items': ['Sales Person', 'Territory', 'Sales Partner']
},
{
'items': ['Budget']
}
]
}

View File

@ -0,0 +1,20 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'payment_gateway_account',
'non_standard_fieldnames': {
'Subscription Plan': 'payment_gateway'
},
'transactions': [
{
'items': ['Payment Request']
},
{
'items': ['Subscription Plan']
}
]
}

View File

@ -0,0 +1,22 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'payment_term',
'transactions': [
{
'label': _('Sales'),
'items': ['Sales Invoice', 'Sales Order', 'Quotation']
},
{
'label': _('Purchase'),
'items': ['Purchase Invoice', 'Purchase Order']
},
{
'items': ['Payment Terms Template']
}
]
}

View File

@ -0,0 +1,33 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'payment_terms_template',
'non_standard_fieldnames': {
'Customer Group': 'payment_terms',
'Supplier Group': 'payment_terms',
'Supplier': 'payment_terms',
'Customer': 'payment_terms'
},
'transactions': [
{
'label': _('Sales'),
'items': ['Sales Invoice', 'Sales Order', 'Quotation']
},
{
'label': _('Purchase'),
'items': ['Purchase Invoice', 'Purchase Order']
},
{
'label': _('Party'),
'items': ['Customer', 'Supplier']
},
{
'label': _('Group'),
'items': ['Customer Group', 'Supplier Group']
}
]
}

View File

@ -0,0 +1,14 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'pos_profile',
'transactions': [
{
'items': ['Sales Invoice', 'POS Closing Voucher']
}
]
}

View File

@ -4,6 +4,7 @@
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"item_code",
"col_break1",
@ -15,6 +16,10 @@
"image_section",
"image",
"image_view",
"manufacture_details",
"manufacturer",
"column_break_13",
"manufacturer_part_no",
"quantity_and_rate",
"received_qty",
"qty",
@ -728,11 +733,32 @@
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
},
{
"fieldname": "manufacture_details",
"fieldtype": "Section Break",
"label": "Manufacture"
},
{
"fieldname": "manufacturer",
"fieldtype": "Link",
"label": "Manufacturer",
"options": "Manufacturer"
},
{
"fieldname": "column_break_13",
"fieldtype": "Column Break"
},
{
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
"label": "Manufacturer Part Number",
"read_only": 1
}
],
"idx": 1,
"istable": 1,
"modified": "2019-05-25 22:04:48.435730",
"modified": "2019-06-02 06:36:17.078419",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",

View File

@ -0,0 +1,22 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'taxes_and_charges',
'non_standard_fieldnames': {
'Tax Rule': 'purchase_tax_template',
},
'transactions': [
{
'label': _('Transactions'),
'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt']
},
{
'label': _('References'),
'items': ['Supplier Quotation', 'Tax Rule']
}
]
}

View File

@ -0,0 +1,24 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'taxes_and_charges',
'non_standard_fieldnames': {
'Tax Rule': 'sales_tax_template',
'Subscription': 'tax_template',
'Restaurant': 'default_tax_template'
},
'transactions': [
{
'label': _('Transactions'),
'items': ['Sales Invoice', 'Sales Order', 'Delivery Note']
},
{
'label': _('References'),
'items': ['POS Profile', 'Subscription', 'Restaurant', 'Tax Rule']
}
]
}

View File

@ -0,0 +1,15 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'share_type',
'transactions': [
{
'label': _('References'),
'items': ['Share Transfer', 'Shareholder']
}
]
}

View File

@ -0,0 +1,17 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'shareholder',
'non_standard_fieldnames': {
'Share Transfer': 'to_shareholder'
},
'transactions': [
{
'items': ['Share Transfer']
}
]
}

View File

@ -0,0 +1,26 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'shipping_rule',
'non_standard_fieldnames': {
'Payment Entry': 'party_name'
},
'transactions': [
{
'label': _('Pre Sales'),
'items': ['Quotation', 'Supplier Quotation']
},
{
'label': _('Sales'),
'items': ['Sales Order', 'Delivery Note', 'Sales Invoice']
},
{
'label': _('Purchase'),
'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt']
}
]
}

View File

@ -0,0 +1,19 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'subscription_plan',
'non_standard_fieldnames': {
'Payment Request': 'plan',
'Subscription': 'plan'
},
'transactions': [
{
'label': _('References'),
'items': ['Payment Request', 'Subscription']
}
]
}

View File

@ -0,0 +1,31 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'tax_category',
'transactions': [
{
'label': _('Pre Sales'),
'items': ['Quotation', 'Supplier Quotation']
},
{
'label': _('Sales'),
'items': ['Sales Invoice', 'Delivery Note', 'Sales Order']
},
{
'label': _('Purchase'),
'items': ['Purchase Invoice', 'Purchase Receipt']
},
{
'label': _('Party'),
'items': ['Customer', 'Supplier']
},
{
'label': _('Taxes'),
'items': ['Item', 'Tax Rule']
}
]
}

View File

@ -0,0 +1,14 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'tax_withholding_category',
'transactions': [
{
'items': ['Supplier']
}
]
}

View File

@ -46,6 +46,8 @@
var range2 = report.columns[12].label;
var range3 = report.columns[13].label;
var range4 = report.columns[14].label;
var range5 = report.columns[15].label;
var range6 = report.columns[16].label;
%}
{% if(balance_row) { %}
<table class="table table-bordered table-condensed">
@ -56,8 +58,10 @@
<col style="width: 18mm;">
<col style="width: 18mm;">
<col style="width: 18mm;">
<col style="width: 18mm;">
<col style="width: 18mm;">
<col style="width: 18mm;">
<col style="width: 18mm;">
<col style="width: 18mm;">
<col style="width: 18mm;">
</colgroup>
<thead>
@ -67,16 +71,20 @@
<th>{%= __(range2) %}</th>
<th>{%= __(range3) %}</th>
<th>{%= __(range4) %}</th>
<th>{%= __(range5) %}</th>
<th>{%= __(range6) %}</th>
<th>{%= __("Total") %}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{%= __("Total Outstanding") %}</td>
<td class="text-right">{%= format_currency(balance_row[range1]) %}</td>
<td class="text-right">{%= format_number(balance_row[range1], null, 2) %}</td>
<td class="text-right">{%= format_currency(balance_row[range2]) %}</td>
<td class="text-right">{%= format_currency(balance_row[range3]) %}</td>
<td class="text-right">{%= format_currency(balance_row[range4]) %}</td>
<td class="text-right">{%= format_currency(balance_row[range5]) %}</td>
<td class="text-right">{%= format_currency(balance_row[range6]) %}</td>
<td class="text-right">
{%= format_currency(flt(balance_row[("outstanding_amount")]), data[data.length-1]["currency"]) %}
</td>
@ -86,6 +94,8 @@
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="text-right">
{%= format_currency(flt(balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %}
</td>
@ -95,6 +105,8 @@
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th class="text-right">
{%= format_currency(flt(balance_row[("outstanding_amount")]-balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %}</th>
</tr>

View File

@ -23,6 +23,9 @@
{% } %}
<h2 class="text-center">{%= __(report.report_name) %}</h2>
<h3 class="text-center">{%= filters.company %}</h3>
{% if 'cost_center' in filters %}
<h3 class="text-center">{%= filters.cost_center %}</h3>
{% endif %}
<h3 class="text-center">{%= filters.fiscal_year %}</h3>
<h5 class="text-center">{%= __("Currency") %} : {%= filters.presentation_currency || erpnext.get_currency(filters.company) %} </h4>
{% if (filters.from_date) { %}
@ -39,7 +42,7 @@
</tr>
</thead>
<tbody>
{% for(var j=0, k=data.length; j<k; j++) { %}
{% for(var j=0, k=data.length-1; j<k; j++) { %}
{%
var row = data[j];
var row_class = data[j].parent_account ? "" : "financial-statements-important";

View File

@ -33,7 +33,7 @@
</tr>
</thead>
<tbody>
{% for(var i=0, l=data.length; i<l; i++) { %}
{% for(var i=0, l=data.length-1; i<l; i++) { %}
<tr>
{% if(data[i].posting_date) { %}
<td>{%= frappe.datetime.str_to_user(data[i].posting_date) %}</td>

View File

@ -128,7 +128,7 @@ def get_gl_entries(filters):
order_by_statement = "order by posting_date, voucher_type, voucher_no"
if filters.get("group_by") == _("Group by Voucher (Consolidated)"):
group_by_statement = "group by voucher_type, voucher_no, account, cost_center"
group_by_statement = "group by voucher_type, voucher_no, account, cost_center, against_voucher"
select_fields = """, sum(debit) as debit, sum(credit) as credit,
sum(debit_in_account_currency) as debit_in_account_currency,
sum(credit_in_account_currency) as credit_in_account_currency"""

View File

@ -102,7 +102,9 @@ def get_conditions(filters):
("customer", " and `tabSales Invoice`.customer = %(customer)s"),
("item_code", " and `tabSales Invoice Item`.item_code = %(item_code)s"),
("from_date", " and `tabSales Invoice`.posting_date>=%(from_date)s"),
("to_date", " and `tabSales Invoice`.posting_date<=%(to_date)s")):
("to_date", " and `tabSales Invoice`.posting_date<=%(to_date)s"),
("company_gstin", " and `tabSales Invoice`.company_gstin = %(company_gstin)s"),
("invoice_type", " and `tabSales Invoice`.invoice_type = %(invoice_type)s")):
if filters.get(opts[0]):
conditions += opts[1]

View File

@ -17,6 +17,10 @@
"col_break1",
"image",
"image_view",
"manufacture_details",
"manufacturer",
"column_break_14",
"manufacturer_part_no",
"quantity_and_rate",
"qty",
"stock_uom",
@ -672,11 +676,32 @@
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
},
{
"fieldname": "manufacture_details",
"fieldtype": "Section Break",
"label": "Manufacture"
},
{
"fieldname": "manufacturer",
"fieldtype": "Link",
"label": "Manufacturer",
"options": "Manufacturer"
},
{
"fieldname": "column_break_14",
"fieldtype": "Column Break"
},
{
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
"label": "Manufacturer Part Number",
"read_only": 1
}
],
"idx": 1,
"istable": 1,
"modified": "2019-05-25 22:10:32.518941",
"modified": "2019-06-02 06:34:47.495730",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",

View File

@ -18,6 +18,10 @@
"col_break1",
"image",
"image_view",
"manufacture_details",
"manufacturer",
"column_break_15",
"manufacturer_part_no",
"quantity_and_rate",
"qty",
"stock_uom",
@ -285,6 +289,7 @@
"read_only": 1
},
{
"default": "0",
"fieldname": "is_free_item",
"fieldtype": "Check",
"label": "Is Free Item",
@ -493,6 +498,7 @@
},
{
"allow_on_submit": 1,
"default": "0",
"fieldname": "page_break",
"fieldtype": "Check",
"label": "Page Break",
@ -500,11 +506,33 @@
"oldfieldname": "page_break",
"oldfieldtype": "Check",
"print_hide": 1
},
{
"collapsible": 1,
"fieldname": "manufacture_details",
"fieldtype": "Section Break",
"label": "Manufacture"
},
{
"fieldname": "manufacturer",
"fieldtype": "Link",
"label": "Manufacturer",
"options": "Manufacturer"
},
{
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
"label": "Manufacturer Part Number",
"read_only": 1
},
{
"fieldname": "column_break_15",
"fieldtype": "Column Break"
}
],
"idx": 1,
"istable": 1,
"modified": "2019-05-01 17:35:05.078030",
"modified": "2019-06-02 05:32:46.019237",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Item",

View File

@ -59,14 +59,14 @@ def get_data():
"items": [
{
"type": "doctype",
"name": "Customer Feedback",
"description":_("Customer Feedback"),
"name": "Quality Feedback",
"description":_("Quality Feedback"),
"onboard": 1,
},
{
"type": "doctype",
"name": "Customer Feedback Template",
"description":_("Customer Feedback Template"),
"name": "Quality Feedback Template",
"description":_("Quality Feedback Template"),
}
]
},

View File

@ -161,6 +161,10 @@ def get_data():
"type": "doctype",
"name": "Item Alternative",
},
{
"type": "doctype",
"name": "Item Manufacturer",
},
{
"type": "doctype",
"name": "Item Variant Settings",

View File

@ -152,6 +152,9 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
conditions = []
if not filters["item_group"]:
filters.pop("item_group", None)
description_cond = ''
if frappe.db.count('Item', cache=True) < 50000:
# scan description only if items are less than 50000
@ -437,3 +440,20 @@ def get_batch_numbers(doctype, txt, searchfield, start, page_len, filters):
query += " and item = {item}".format(item = frappe.db.escape(filters.get('item')))
return frappe.db.sql(query, filters)
@frappe.whitelist()
def item_manufacturer_query(doctype, txt, searchfield, start, page_len, filters):
search_txt = "{0}%".format(txt)
item_filters = {
'manufacturer': ('like', search_txt),
'item_code': filters.get("item_code")
}
return frappe.get_all("Item Manufacturer",
fields = "manufacturer",
filters = item_filters,
limit_start=start,
limit_page_length=page_len,
as_list=1
)

View File

@ -39,8 +39,8 @@
"item_name": "Atocopherol",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:16.577151",
@ -123,8 +123,8 @@
"item_name": "Abacavir",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:16.678257",
@ -207,8 +207,6 @@
"item_name": "Abciximab",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:16.695413",
@ -291,8 +289,6 @@
"item_name": "Acacia",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:16.797774",
@ -375,8 +371,6 @@
"item_name": "Acamprosate",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:16.826952",
@ -459,8 +453,6 @@
"item_name": "Acarbose",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:16.843890",
@ -543,8 +535,6 @@
"item_name": "Acebrofylline",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:16.969984",
@ -627,8 +617,6 @@
"item_name": "Acebrofylline (SR)",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:16.987354",
@ -711,8 +699,6 @@
"item_name": "Aceclofenac",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.004369",
@ -795,8 +781,6 @@
"item_name": "Ash",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.021192",
@ -879,8 +863,6 @@
"item_name": "Asparaginase",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.038058",
@ -963,8 +945,6 @@
"item_name": "Aspartame",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.054463",
@ -1047,8 +1027,6 @@
"item_name": "Aspartic Acid",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.071001",
@ -1131,8 +1109,6 @@
"item_name": "Bleomycin",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.087170",
@ -1215,8 +1191,6 @@
"item_name": "Bleomycin Sulphate",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.103691",
@ -1299,8 +1273,6 @@
"item_name": "Blue cap contains",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.120040",
@ -1383,8 +1355,6 @@
"item_name": "Boran",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.135964",
@ -1467,8 +1437,6 @@
"item_name": "Borax",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.152575",
@ -1551,8 +1519,6 @@
"item_name": "Chlorbutanol",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.168998",
@ -1635,8 +1601,6 @@
"item_name": "Chlorbutol",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.185316",
@ -1719,8 +1683,6 @@
"item_name": "Chlordiazepoxide",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.208361",
@ -1803,8 +1765,6 @@
"item_name": "Chlordiazepoxide and Clidinium Bromide",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.224341",
@ -1887,8 +1847,6 @@
"item_name": "Chlorhexidine",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.240634",
@ -1971,8 +1929,6 @@
"item_name": "Chlorhexidine 40%",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.256922",
@ -2055,8 +2011,6 @@
"item_name": "Chlorhexidine Acetate",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.274789",
@ -2139,8 +2093,6 @@
"item_name": "Chlorhexidine Gluconate",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.295371",
@ -2223,8 +2175,6 @@
"item_name": "Chlorhexidine HCL",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.312916",
@ -2307,8 +2257,6 @@
"item_name": "Chlorhexidine Hydrochloride",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.329570",
@ -2391,8 +2339,6 @@
"item_name": "Chloride",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.346088",
@ -2475,8 +2421,6 @@
"item_name": "Fosfomycin Tromethamine",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.362777",
@ -2559,8 +2503,6 @@
"item_name": "Fosinopril",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.379465",
@ -2643,8 +2585,6 @@
"item_name": "Iodochlorhydroxyquinoline",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.396068",
@ -2727,8 +2667,6 @@
"item_name": "Iodochlorohydroxyquinoline",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.412734",
@ -2811,8 +2749,6 @@
"item_name": "Ipratropium",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.429333",
@ -2895,8 +2831,6 @@
"item_name": "Mebeverine hydrochloride",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.445814",
@ -2979,8 +2913,6 @@
"item_name": "Mecetronium ethylsulphate",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.461696",
@ -3063,8 +2995,6 @@
"item_name": "Meclizine",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.478020",
@ -3147,8 +3077,8 @@
"item_name": "Oxaprozin",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.496221",
@ -3231,8 +3161,6 @@
"item_name": "Oxazepam",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.511933",
@ -3315,8 +3243,6 @@
"item_name": "Oxcarbazepine",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.528472",
@ -3399,8 +3325,6 @@
"item_name": "Oxetacaine",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.544177",
@ -3483,8 +3407,6 @@
"item_name": "Oxethazaine",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.560193",
@ -3567,8 +3489,6 @@
"item_name": "Suxamethonium Chloride",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.576447",
@ -3651,8 +3571,6 @@
"item_name": "Tacrolimus",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.593481",
@ -3735,8 +3653,6 @@
"item_name": "Ubiquinol",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.609930",
@ -3819,8 +3735,6 @@
"item_name": "Vitamin B12",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.626225",
@ -3903,8 +3817,6 @@
"item_name": "Vitamin B1Hydrochloride",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.642423",
@ -3987,8 +3899,6 @@
"item_name": "Vitamin B1Monohydrate",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.658946",
@ -4071,8 +3981,6 @@
"item_name": "Vitamin B2",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.675234",
@ -4155,8 +4063,6 @@
"item_name": "Vitamin B3",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.691598",
@ -4239,8 +4145,6 @@
"item_name": "Vitamin D4",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.707840",
@ -4323,8 +4227,6 @@
"item_name": "Vitamin E",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.723859",
@ -4407,8 +4309,6 @@
"item_name": "Wheat Germ Oil",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.739829",
@ -4491,8 +4391,6 @@
"item_name": "Wheatgrass extr",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.757695",
@ -4575,8 +4473,6 @@
"item_name": "Whey Protein",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.774098",
@ -4659,8 +4555,6 @@
"item_name": "Xylometazoline",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.790224",
@ -4743,8 +4637,6 @@
"item_name": "Xylometazoline Hydrochloride",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.806359",
@ -4827,8 +4719,6 @@
"item_name": "Yeast",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.823305",
@ -4911,8 +4801,6 @@
"item_name": "Yellow Fever Vaccine",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.840250",
@ -4995,8 +4883,6 @@
"item_name": "Zafirlukast",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.856856",
@ -5079,8 +4965,6 @@
"item_name": "Zaleplon",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.873287",
@ -5163,8 +5047,6 @@
"item_name": "Zaltoprofen",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.889263",
@ -5247,8 +5129,6 @@
"item_name": "Zanamivir",
"last_purchase_rate": 0.0,
"lead_time_days": 0,
"manufacturer": null,
"manufacturer_part_no": null,
"max_discount": 0.0,
"min_order_qty": 0.0,
"modified": "2017-07-06 12:53:17.905022",

View File

@ -14,7 +14,7 @@ data = {
'Student Attendance Tool',
'Student Applicant'
],
'default_portal_role': 'LMS User',
'default_portal_role': 'Student',
'restricted_roles': [
'Student',
'Instructor',

View File

@ -1,230 +1,81 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 0,
"allow_rename": 1,
"autoname": "field:title",
"beta": 0,
"creation": "2018-10-17 05:45:38.471670",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"title",
"author",
"content",
"publish_date"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Title",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "author",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Author",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Author"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "content",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Content",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Content"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "publish_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Publish Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Publish Date"
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-25 19:06:56.016865",
"modified": "2019-06-12 12:36:58.740340",
"modified_by": "Administrator",
"module": "Education",
"name": "Article",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 0
"share": 1
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
"track_changes": 1
}

View File

@ -1,514 +1,113 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:course_code",
"beta": 0,
"creation": "2015-09-07 12:39:55.181893",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 0,
"engine": "InnoDB",
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:course_name",
"creation": "2015-09-07 12:39:55.181893",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"course_name",
"department",
"section_break_6",
"topics",
"description",
"hero_image",
"assessment",
"default_grading_scale",
"assessment_criteria"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "course_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Course Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "department",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Department",
"length": 0,
"no_copy": 0,
"options": "Department",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "parent_course",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Parent Course (Leave blank, if this isn't part of Parent Course)",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "course_code",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Course Code",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"fieldname": "course_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Course Name",
"reqd": 1,
"unique": 1
},
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "course_abbreviation",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Course Abbreviation",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "department",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Department",
"options": "Department"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"label": "Portal Settings"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "topics",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Topics",
"length": 0,
"no_copy": 0,
"options": "Course Topic",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "topics",
"fieldtype": "Table",
"label": "Topics",
"options": "Course Topic"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "course_intro",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Course Intro",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "hero_image",
"fieldtype": "Attach Image",
"hidden": 1,
"label": "Hero Image"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "hero_image",
"fieldtype": "Attach Image",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Hero Image",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "assessment",
"fieldtype": "Section Break",
"label": "Assessment"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "assessment",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Assessment",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "default_grading_scale",
"fieldtype": "Link",
"label": "Default Grading Scale",
"options": "Grading Scale"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "default_grading_scale",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Grading Scale",
"length": 0,
"no_copy": 0,
"options": "Grading Scale",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "assessment_criteria",
"fieldtype": "Table",
"label": "Assessment Criteria",
"options": "Course Assessment Criteria"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "assessment_criteria",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Assessment Criteria",
"length": 0,
"no_copy": 0,
"options": "Course Assessment Criteria",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Description"
}
],
"has_web_view": 0,
"hide_toolbar": 0,
"idx": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2019-04-09 11:35:27.354877",
"modified_by": "Administrator",
"module": "Education",
"name": "Course",
"name_case": "",
"owner": "Administrator",
],
"image_field": "hero_image",
"modified": "2019-06-12 12:34:23.748157",
"modified_by": "Administrator",
"module": "Education",
"name": "Course",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"share": 1,
"write": 1
},
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"share": 1,
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"restrict_to_domain": "Education",
"search_fields": "course_name",
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 0,
"track_seen": 0,
"track_views": 0
],
"restrict_to_domain": "Education",
"search_fields": "course_name",
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@ -1,17 +1,14 @@
[
{
"course_name": "_Test Course",
"course_code": "TC100",
"course_name": "TC100",
"course_abbreviation": "TC"
},
{
"course_name": "_Test Course 1",
"course_code": "TC101",
"course_name": "TC101",
"course_abbreviation": "TC1"
},
{
"course_name": "_Test Course 2",
"course_code": "TC102",
"course_name": "TC102",
"course_abbreviation": "TC2"
}
]

View File

@ -35,7 +35,7 @@ class CourseEnrollment(Document):
if enrollment:
frappe.throw(_("Student is already enrolled."))
def add_quiz_activity(self, quiz_name, quiz_response,answers, score, status):
def add_quiz_activity(self, quiz_name, quiz_response, answers, score, status):
result = {k: ('Correct' if v else 'Wrong') for k,v in answers.items()}
result_data = []
for key in answers:
@ -43,7 +43,9 @@ class CourseEnrollment(Document):
item['question'] = key
item['quiz_result'] = result[key]
try:
if isinstance(quiz_response[key], list):
if not quiz_response[key]:
item['selected_option'] = "Unattempted"
elif isinstance(quiz_response[key], list):
item['selected_option'] = ', '.join(frappe.get_value('Options', res, 'option') for res in quiz_response[key])
else:
item['selected_option'] = frappe.get_value('Options', quiz_response[key], 'option')
@ -59,11 +61,12 @@ class CourseEnrollment(Document):
"result": result_data,
"score": score,
"status": status
}).insert()
}).insert(ignore_permissions = True)
def add_activity(self, content_type, content):
if check_activity_exists(self.name, content_type, content):
pass
activity = check_activity_exists(self.name, content_type, content)
if activity:
return activity
else:
activity = frappe.get_doc({
"doctype": "Course Activity",
@ -71,9 +74,14 @@ class CourseEnrollment(Document):
"content_type": content_type,
"content": content,
"activity_date": frappe.utils.datetime.datetime.now()
})
activity.insert()
})
activity.insert(ignore_permissions=True)
return activity.name
def check_activity_exists(enrollment, content_type, content):
activity = frappe.get_all("Course Activity", filters={'enrollment': enrollment, 'content_type': content_type, 'content': content})
return bool(activity)
if activity:
return activity[0].name
else:
return None

View File

@ -1,627 +1,177 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:program_code",
"beta": 0,
"autoname": "field:program_name",
"creation": "2015-09-07 12:54:03.609282",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 0,
"engine": "InnoDB",
"field_order": [
"program_name",
"department",
"column_break_3",
"program_abbreviation",
"section_break_courses",
"courses",
"section_break_5",
"is_published",
"allow_self_enroll",
"is_featured",
"column_break_11",
"intro_video",
"hero_image",
"description"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "program_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Program Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "department",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Department",
"length": 0,
"no_copy": 0,
"options": "Department",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "program_code",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Program Code",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "department",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Department",
"options": "Department"
},
{
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"fieldname": "program_abbreviation",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Program Abbreviation",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Program Abbreviation"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Portal Settings",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Portal Settings"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "courses",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Courses",
"length": 0,
"no_copy": 0,
"options": "Program Course",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"options": "Program Course"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "section_break_9",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"depends_on": "is_published",
"fieldname": "description",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Description"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"depends_on": "is_published",
"fieldname": "intro_video",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Intro Video",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Intro Video"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "hero_image",
"fieldtype": "Attach Image",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Hero Image",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"hidden": 1,
"label": "Hero Image"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break_11",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"fetch_if_empty": 0,
"fieldname": "is_published",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Published",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Is Published"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"fetch_if_empty": 0,
"depends_on": "eval: doc.is_published == 1",
"fieldname": "is_featured",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Featured",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Is Featured"
},
{
"default": "0",
"depends_on": "eval: doc.is_published == 1",
"fieldname": "allow_self_enroll",
"fieldtype": "Check",
"label": "Allow Self Enroll"
},
{
"fieldname": "section_break_courses",
"fieldtype": "Section Break",
"label": "Courses"
},
{
"fieldname": "column_break_11",
"fieldtype": "Column Break"
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2019-03-18 15:26:56.737903",
"image_field": "hero_image",
"modified": "2019-06-12 12:31:14.999346",
"modified_by": "Administrator",
"module": "Education",
"name": "Program",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Guest",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Student",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"share": 1,
"write": 1
},
{
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Guest",
"share": 1
},
{
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Student",
"share": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Education",
"route": "",
"search_fields": "program_name",
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 0,
"track_seen": 0,
"track_views": 0
"sort_order": "DESC"
}

View File

@ -1,13 +1,11 @@
[
{
"program_name": "_Test Program 1",
"program_code": "_TP1",
"program_name": "_TP1",
"description": "Test Description",
"program_abbreviation": "TP1"
},
{
"program_name": "_Test Program 2",
"program_code": "_TP2",
"program_name": "_TP2",
"description": "Test Description",
"program_abbreviation": "TP2"
}

View File

@ -1,169 +1,39 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2015-09-07 14:37:01.886859",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"creation": "2015-09-07 14:37:01.886859",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"course",
"required"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "course",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 1,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Course",
"length": 0,
"no_copy": 0,
"options": "Course",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "course",
"fieldtype": "Link",
"in_global_search": 1,
"in_list_view": 1,
"label": "Course",
"options": "Course",
"reqd": 1
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "course.course_name",
"fieldname": "course_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Course Name",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "required",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Mandatory",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"default": "0",
"fieldname": "required",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Mandatory"
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"menu_index": 0,
"modified": "2018-05-16 22:42:58.326734",
"modified_by": "Administrator",
"module": "Education",
"name": "Program Course",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Education",
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0
],
"istable": 1,
"modified": "2019-06-12 12:42:12.845972",
"modified_by": "Administrator",
"module": "Education",
"name": "Program Course",
"owner": "Administrator",
"permissions": [],
"restrict_to_domain": "Education",
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -66,7 +66,7 @@ class ProgramEnrollment(Document):
msgprint(_("Fee Records Created - {0}").format(comma_and(fee_list)))
def get_courses(self):
return frappe.db.sql('''select course, course_name from `tabProgram Course` where parent = %s and required = 1''', (self.program), as_dict=1)
return frappe.db.sql('''select course from `tabProgram Course` where parent = %s and required = 1''', (self.program), as_dict=1)
def create_course_enrollments(self):
student = frappe.get_doc("Student", self.student)
@ -96,29 +96,6 @@ class ProgramEnrollment(Document):
quiz_progress.program = self.program
return quiz_progress
def get_program_progress(self):
import math
program = frappe.get_doc("Program", self.program)
program_progress = {}
progress = []
for course in program.get_all_children():
course_progress = lms.get_student_course_details(course.course, self.program)
is_complete = False
if course_progress['flag'] == "Completed":
is_complete = True
progress.append({'course_name': course.course_name, 'name': course.course, 'is_complete': is_complete})
program_progress['progress'] = progress
program_progress['name'] = self.program
program_progress['program'] = frappe.get_value("Program", self.program, 'program_name')
try:
program_progress['percentage'] = math.ceil((sum([item['is_complete'] for item in progress] * 100)/len(progress)))
except ZeroDivisionError:
program_progress['percentage'] = 0
return program_progress
@frappe.whitelist()
def get_program_courses(doctype, txt, searchfield, start, page_len, filters):
if filters.get('program'):

View File

@ -1,167 +1,80 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 0,
"autoname": "format:QUESTION-{#####}",
"beta": 0,
"creation": "2018-10-01 15:58:00.696815",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"allow_import": 1,
"autoname": "format:QUESTION-{#####}",
"creation": "2018-10-01 15:58:00.696815",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"question",
"options",
"question_type"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "question",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Question",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "question",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Question",
"reqd": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "",
"fetch_if_empty": 0,
"fieldname": "options",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Options",
"length": 0,
"no_copy": 0,
"options": "Options",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"fieldname": "options",
"fieldtype": "Table",
"label": "Options",
"options": "Options",
"reqd": 1
},
{
"fieldname": "question_type",
"fieldtype": "Select",
"in_standard_filter": 1,
"label": "Type",
"options": "\nSingle Correct Answer\nMultiple Correct Answer",
"read_only": 1
}
],
"has_web_view": 0,
"hide_toolbar": 0,
"idx": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2019-04-22 14:02:08.140652",
"modified_by": "Administrator",
"module": "Education",
"name": "Question",
"name_case": "",
"owner": "Administrator",
],
"modified": "2019-05-30 18:39:21.880974",
"modified_by": "Administrator",
"module": "Education",
"name": "Question",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"share": 1,
"write": 1
},
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"share": 1,
"write": 1
},
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 0
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS User",
"share": 1
}
],
"quick_entry": 1,
"read_only": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 0,
"track_seen": 0,
"track_views": 0
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@ -12,6 +12,7 @@ class Question(Document):
def validate(self):
self.check_at_least_one_option()
self.check_minimum_one_correct_answer()
self.set_question_type()
def check_at_least_one_option(self):
if len(self.options) <= 1:
@ -26,6 +27,13 @@ class Question(Document):
else:
frappe.throw(_("A qustion must have at least one correct options"))
def set_question_type(self):
correct_options = [option for option in self.options if option.is_correct]
if len(correct_options) > 1:
self.question_type = "Multiple Correct Answer"
else:
self.question_type = "Single Correct Answer"
def get_answer(self):
options = self.options
answers = [item.name for item in options if item.is_correct == True]

View File

@ -1,299 +1,107 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:title",
"beta": 0,
"creation": "2018-10-17 05:52:50.149904",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"title",
"question",
"quiz_configuration_section",
"passing_score",
"max_attempts",
"grading_basis"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Title",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "question",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Question",
"length": 0,
"no_copy": 0,
"options": "Quiz Question",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"reqd": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "quiz_configuration_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Quiz Configuration",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Quiz Configuration"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "75",
"description": "Score out of 100",
"fieldname": "passing_score",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Passing Score",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"reqd": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"description": "Enter 0 to waive limit",
"fieldname": "max_attempts",
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Max Attempts",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"reqd": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Last Highest Score",
"default": "Latest Highest Score",
"fieldname": "grading_basis",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Grading Basis",
"length": 0,
"no_copy": 0,
"options": "\nLast Attempt\nLast Highest Score",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"options": "Latest Highest Score\nLatest Attempt"
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-25 19:07:36.190116",
"modified": "2019-06-12 12:23:57.020508",
"modified_by": "Administrator",
"module": "Education",
"name": "Quiz",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 0
"share": 1
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
"track_changes": 1
}

View File

@ -7,51 +7,47 @@ import frappe
from frappe.model.document import Document
class Quiz(Document):
def validate(self):
if self.passing_score > 100:
frappe.throw("Passing Score value should be between 0 and 100")
def validate_quiz_attempts(self, enrollment, quiz_name):
if self.max_attempts > 0:
try:
if len(frappe.get_all("Quiz Activity", {'enrollment': enrollment.name, 'quiz': quiz_name})) >= self.max_attempts:
frappe.throw('Maximum attempts reached!')
except Exception as e:
pass
def allowed_attempt(self, enrollment, quiz_name):
if self.max_attempts == 0:
return True
try:
if len(frappe.get_all("Quiz Activity", {'enrollment': enrollment.name, 'quiz': quiz_name})) >= self.max_attempts:
frappe.msgprint("Maximum attempts for this quiz reached!")
return False
else:
return True
except Exception as e:
return False
def evaluate(self, response_dict, quiz_name):
# self.validate_quiz_attempts(enrollment, quiz_name)
questions = [frappe.get_doc('Question', question.question_link) for question in self.question]
answers = {q.name:q.get_answer() for q in questions}
correct_answers = {}
result = {}
for key in answers:
try:
if isinstance(response_dict[key], list):
result = compare_list_elementwise(response_dict[key], answers[key])
is_correct = compare_list_elementwise(response_dict[key], answers[key])
else:
result = (response_dict[key] == answers[key])
except:
result = False
correct_answers[key] = result
score = (sum(correct_answers.values()) * 100 ) / len(answers)
is_correct = (response_dict[key] == answers[key])
except Exception as e:
is_correct = False
result[key] = is_correct
score = (sum(result.values()) * 100 ) / len(answers)
if score >= self.passing_score:
status = "Pass"
else:
status = "Fail"
return correct_answers, score, status
return result, score, status
def get_questions(self):
quiz_question = self.get_all_children()
if quiz_question:
questions = [frappe.get_doc('Question', question.question_link).as_dict() for question in quiz_question]
for question in questions:
correct_options = [option.is_correct for option in question.options]
if sum(correct_options) > 1:
question['type'] = "MultipleChoice"
else:
question['type'] = "SingleChoice"
return questions
else:
return None
return [frappe.get_doc('Question', question.question_link) for question in self.question]
def compare_list_elementwise(*args):
try:

View File

@ -1,110 +1,40 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-10-17 06:13:00.098883",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"allow_rename": 1,
"creation": "2018-10-17 06:13:00.098883",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"question_link",
"question"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "question_link",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Question Link",
"length": 0,
"no_copy": 0,
"options": "Question",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "question_link",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Question Link",
"options": "Question",
"reqd": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "question_link.question",
"fieldname": "question",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Question",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"fetch_from": "question_link.question",
"fieldname": "question",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Question",
"read_only": 1
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2018-10-18 15:35:12.195250",
"modified_by": "Administrator",
"module": "Education",
"name": "Quiz Question",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
],
"istable": 1,
"modified": "2019-06-12 12:24:02.312577",
"modified_by": "Administrator",
"module": "Education",
"name": "Quiz Question",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -1,145 +1,52 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-10-15 15:52:25.766374",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"creation": "2018-10-15 15:52:25.766374",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"question",
"selected_option",
"quiz_result"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "question",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Question",
"length": 0,
"no_copy": 0,
"options": "Question",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 1,
"translatable": 0,
"unique": 0
},
"fieldname": "question",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Question",
"options": "Question",
"read_only": 1,
"reqd": 1,
"set_only_once": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "selected_option",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Selected Option",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 1,
"translatable": 0,
"unique": 0
},
"fieldname": "selected_option",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Selected Option",
"read_only": 1,
"set_only_once": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "quiz_result",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Result",
"length": 0,
"no_copy": 0,
"options": "\nCorrect\nWrong",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 1,
"translatable": 0,
"unique": 0
"fieldname": "quiz_result",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Result",
"options": "\nCorrect\nWrong",
"read_only": 1,
"reqd": 1,
"set_only_once": 1
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2019-03-27 17:58:54.388848",
"modified_by": "Administrator",
"module": "Education",
"name": "Quiz Result",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
],
"istable": 1,
"modified": "2019-06-03 12:52:32.267392",
"modified_by": "Administrator",
"module": "Education",
"name": "Quiz Result",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -54,7 +54,7 @@ class Student(Document):
'send_welcome_email': 1,
'user_type': 'Website User'
})
student_user.add_roles("Student", "LMS User")
student_user.add_roles("Student")
student_user.save()
update_password_link = student_user.reset_password()

View File

@ -1,297 +1,90 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "field:topic_code",
"beta": 0,
"creation": "2018-12-12 11:37:39.917760",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:topic_name",
"creation": "2018-12-12 11:37:39.917760",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"topic_name",
"topic_content",
"description",
"hero_image"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "topic_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "topic_code",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Code",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"fieldname": "topic_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Name",
"reqd": 1,
"unique": 1
},
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "section_break_4",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "topic_content",
"fieldtype": "Table",
"label": "Topic Content",
"options": "Topic Content"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "topic_content",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Topic Content",
"length": 0,
"no_copy": 0,
"options": "Topic Content",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "hero_image",
"fieldtype": "Attach Image",
"hidden": 1,
"label": "Hero Image"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "hero_image",
"fieldtype": "Attach Image",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Hero Image",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Description"
}
],
"has_web_view": 0,
"hide_toolbar": 0,
"idx": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2019-04-09 11:35:34.137040",
"modified_by": "Administrator",
"module": "Education",
"name": "Topic",
"name_case": "",
"owner": "Administrator",
],
"image_field": "hero_image",
"modified": "2019-06-12 12:34:49.911300",
"modified_by": "Administrator",
"module": "Education",
"name": "Topic",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
},
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Administrator",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Administrator",
"share": 1,
"write": 1
},
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"read_only": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -1,262 +1,112 @@
{
"allow_copy": 0,
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 0,
"allow_rename": 1,
"autoname": "field:title",
"beta": 0,
"creation": "2018-10-17 05:47:13.087395",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"title",
"provider",
"url",
"column_break_4",
"publish_date",
"duration",
"section_break_7",
"description"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"in_list_view": 1,
"label": "Title",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"reqd": 1,
"unique": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"in_list_view": 1,
"label": "Description",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"reqd": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "duration",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Duration",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Duration"
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "url",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"in_list_view": 1,
"label": "URL",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"reqd": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "publish_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Publish Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"label": "Publish Date"
},
{
"fieldname": "provider",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Provider",
"options": "YouTube\nVimeo",
"reqd": 1
},
{
"fieldname": "column_break_4",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_7",
"fieldtype": "Section Break"
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-25 19:07:17.134288",
"modified": "2019-06-12 12:36:48.753092",
"modified_by": "Administrator",
"module": "Education",
"name": "Video",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Instructor",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 0
"share": 1
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
"track_changes": 1
}

View File

@ -9,7 +9,8 @@ from erpnext.setup.utils import insert_record
def setup_education():
if frappe.db.exists('Academic Year', '2015-16'):
disable_desk_access_for_student_role()
if frappe.db.exists("Academic Year", "2015-16"):
# already setup
return
create_academic_sessions()
@ -26,3 +27,22 @@ def create_academic_sessions():
{"doctype": "Academic Term", "academic_year": "2017-18", "term_name": "Semester 2"}
]
insert_record(data)
def disable_desk_access_for_student_role():
try:
student_role = frappe.get_doc("Role", "Student")
except frappe.DoesNotExistError:
create_student_role()
return
student_role.desk_access = 0
student_role.save()
def create_student_role():
student_role = frappe.get_doc({
"doctype": "Role",
"role_name": "Student",
"desk_access": 0,
"restrict_to_domain": "Education"
})
student_role.insert()

View File

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For lice
from __future__ import unicode_literals, division
import frappe
@ -57,9 +56,10 @@ def validate_duplicate_student(students):
# LMS Utils
def get_current_student():
"""
Returns student user name, example EDU-STU-2018-00001 (Based on the naming series).
Takes email from from frappe.session.user
"""Returns current student from frappe.session.user
Returns:
object: Student Document
"""
email = frappe.session.user
if email in ('Administrator', 'Guest'):
@ -70,44 +70,266 @@ def get_current_student():
except (IndexError, frappe.DoesNotExistError):
return None
def check_super_access():
def get_portal_programs():
"""Returns a list of all program to be displayed on the portal
Programs are returned based on the following logic
is_published and (student_is_enrolled or student_can_self_enroll)
Returns:
list of dictionary: List of all programs and to be displayed on the portal along with access rights
"""
published_programs = frappe.get_all("Program", filters={"is_published": True})
if not published_programs:
return None
program_list = [frappe.get_doc("Program", program) for program in published_programs]
portal_programs = [{'program': program, 'has_access': allowed_program_access(program.name)} for program in program_list if allowed_program_access(program.name) or program.allow_self_enroll]
return portal_programs
def allowed_program_access(program, student=None):
"""Returns enrollment status for current student
Args:
program (string): Name of the program
student (object): instance of Student document
Returns:
bool: Is current user enrolled or not
"""
if has_super_access():
return True
if not student:
student = get_current_student()
if student and get_enrollment('program', program, student.name):
return True
else:
return False
def get_enrollment(master, document, student):
"""Gets enrollment for course or program
Args:
master (string): can either be program or course
document (string): program or course name
student (string): Student ID
Returns:
string: Enrollment Name if exists else returns empty string
"""
if master == 'program':
enrollments = frappe.get_all("Program Enrollment", filters={'student':student, 'program': document, 'docstatus': 1})
if master == 'course':
enrollments = frappe.get_all("Course Enrollment", filters={'student':student, 'course': document})
if enrollments:
return enrollments[0].name
else:
return None
@frappe.whitelist()
def enroll_in_program(program_name, student=None):
"""Enroll student in program
Args:
program_name (string): Name of the program to be enrolled into
student (string, optional): name of student who has to be enrolled, if not
provided, a student will be created from the current user
Returns:
string: name of the program enrollment document
"""
if has_super_access():
return
if not student == None:
student = frappe.get_doc("Student", student)
else:
# Check if self enrollment in allowed
program = frappe.get_doc('Program', program_name)
if not program.allow_self_enroll:
return frappe.throw("You are not allowed to enroll for this course")
student = get_current_student()
if not student:
student = create_student_from_current_user()
# Check if student is already enrolled in program
enrollment = get_enrollment('program', program_name, student.name)
if enrollment:
return enrollment
# Check if self enrollment in allowed
program = frappe.get_doc('Program', program_name)
if not program.allow_self_enroll:
return frappe.throw("You are not allowed to enroll for this course")
# Enroll in program
program_enrollment = student.enroll_in_program(program_name)
return program_enrollment.name
def has_super_access():
"""Check if user has a role that allows full access to LMS
Returns:
bool: true if user has access to all lms content
"""
current_user = frappe.get_doc('User', frappe.session.user)
roles = set([role.role for role in current_user.roles])
return bool(roles & {'Administrator', 'Instructor', 'Education Manager', 'System Manager', 'Academic User'})
def get_program_enrollment(program_name):
"""
Function to get program enrollments for a particular student for a program
"""
@frappe.whitelist()
def add_activity(course, content_type, content, program):
if has_super_access():
return None
student = get_current_student()
if not student:
return None
return frappe.throw("Student with email {0} does not exist".format(frappe.session.user), frappe.DoesNotExistError)
enrollment = get_or_create_course_enrollment(course, program)
if content_type == 'Quiz':
return
else:
enrollment = frappe.get_all("Program Enrollment", filters={'student':student.name, 'program': program_name})
if enrollment:
return enrollment[0].name
return enrollment.add_activity(content_type, content)
@frappe.whitelist()
def evaluate_quiz(quiz_response, quiz_name, course, program):
import json
student = get_current_student()
quiz_response = json.loads(quiz_response)
quiz = frappe.get_doc("Quiz", quiz_name)
result, score, status = quiz.evaluate(quiz_response, quiz_name)
if has_super_access():
return {'result': result, 'score': score, 'status': status}
if student:
enrollment = get_or_create_course_enrollment(course, program)
if quiz.allowed_attempt(enrollment, quiz_name):
enrollment.add_quiz_activity(quiz_name, quiz_response, result, score, status)
return {'result': result, 'score': score, 'status': status}
else:
return None
def get_program_and_enrollment_status(program_name):
program = frappe.get_doc('Program', program_name)
is_enrolled = bool(get_program_enrollment(program_name)) or check_super_access()
return {'program': program, 'is_enrolled': is_enrolled}
@frappe.whitelist()
def get_quiz(quiz_name, course):
try:
quiz = frappe.get_doc("Quiz", quiz_name)
questions = quiz.get_questions()
except:
frappe.throw("Quiz {0} does not exist".format(quiz_name))
return None
def get_course_enrollment(course_name):
questions = [{
'name': question.name,
'question': question.question,
'type': question.question_type,
'options': [{'name': option.name, 'option': option.option}
for option in question.options],
} for question in questions]
if has_super_access():
return {'questions': questions, 'activity': None}
student = get_current_student()
course_enrollment = get_enrollment("course", course, student.name)
status, score, result = check_quiz_completion(quiz, course_enrollment)
return {'questions': questions, 'activity': {'is_complete': status, 'score': score, 'result': result}}
def get_topic_progress(topic, course_name, program):
"""
Return the porgress of a course in a program as well as the content to continue from.
:param topic_name:
:param course_name:
"""
student = get_current_student()
if not student:
return None
enrollment_name = frappe.get_all("Course Enrollment", filters={'student': student.name, 'course':course_name})
try:
name = enrollment_name[0].name
enrollment = frappe.get_doc("Course Enrollment", name)
return enrollment
except:
course_enrollment = get_or_create_course_enrollment(course_name, program)
progress = student.get_topic_progress(course_enrollment.name, topic)
if not progress:
return None
count = sum([activity['is_complete'] for activity in progress])
if count == 0:
return {'completed': False, 'started': False}
elif count == len(progress):
return {'completed': True, 'started': True}
elif count < len(progress):
return {'completed': False, 'started': True}
def get_course_progress(course, program):
"""
Return the porgress of a course in a program as well as the content to continue from.
:param topic_name:
:param course_name:
"""
course_progress = []
for course_topic in course.topics:
topic = frappe.get_doc("Topic", course_topic.topic)
progress = get_topic_progress(topic, course.name, program)
if progress:
course_progress.append(progress)
if course_progress:
number_of_completed_topics = sum([activity['completed'] for activity in course_progress])
total_topics = len(course_progress)
if total_topics == 1:
return course_progress[0]
if number_of_completed_topics == 0:
return {'completed': False, 'started': False}
if number_of_completed_topics == total_topics:
return {'completed': True, 'started': True}
if number_of_completed_topics < total_topics:
return {'completed': False, 'started': True}
return None
def get_program_progress(program):
program_progress = []
if not program.courses:
return None
for program_course in program.courses:
course = frappe.get_doc("Course", program_course.course)
progress = get_course_progress(course, program.name)
if progress:
progress['name'] = course.name
progress['course'] = course.course_name
program_progress.append(progress)
if program_progress:
return program_progress
return None
def get_program_completion(program):
topics = frappe.db.sql("""select `tabCourse Topic`.topic, `tabCourse Topic`.parent
from `tabCourse Topic`,
`tabProgram Course`
where `tabCourse Topic`.parent = `tabProgram Course`.course
and `tabProgram Course`.parent = %s""", program.name)
progress = []
for topic in topics:
topic_doc = frappe.get_doc('Topic', topic[0])
topic_progress = get_topic_progress(topic_doc, topic[1], program.name)
if topic_progress:
progress.append(topic_progress)
if progress:
number_of_completed_topics = sum([activity['completed'] for activity in progress if activity])
total_topics = len(progress)
try:
return int((float(number_of_completed_topics)/total_topics)*100)
except ZeroDivisionError:
return 0
return 0
def create_student_from_current_user():
user = frappe.get_doc("User", frappe.session.user)
student = frappe.get_doc({
"doctype": "Student",
"first_name": user.first_name,
@ -115,12 +337,21 @@ def create_student_from_current_user():
"student_email_id": user.email,
"user": frappe.session.user
})
student.save(ignore_permissions=True)
return student
def enroll_in_course(course_name, program_name):
def get_or_create_course_enrollment(course, program):
student = get_current_student()
return student.enroll_in_course(course_name=course_name, program_enrollment=get_program_enrollment(program_name))
course_enrollment = get_enrollment("course", course, student.name)
if not course_enrollment:
program_enrollment = get_enrollment('program', program, student.name)
if not program_enrollment:
frappe.throw("You are not enrolled in program {0}".format(program))
return
return student.enroll_in_course(course_name=course, program_enrollment=get_enrollment('program', program, student.name))
else:
return frappe.get_doc('Course Enrollment', course_enrollment)
def check_content_completion(content_name, content_type, enrollment_name):
activity = frappe.get_all("Course Activity", filters={'enrollment': enrollment_name, 'content_type': content_type, 'content': content_name})
@ -131,7 +362,7 @@ def check_content_completion(content_name, content_type, enrollment_name):
def check_quiz_completion(quiz, enrollment_name):
attempts = frappe.get_all("Quiz Activity", filters={'enrollment': enrollment_name, 'quiz': quiz.name}, fields=["name", "activity_date", "score", "status"])
status = False if quiz.max_attempts == 0 else bool(len(attempts) == quiz.max_attempts)
status = False if quiz.max_attempts == 0 else bool(len(attempts) >= quiz.max_attempts)
score = None
result = None
if attempts:

View File

@ -300,11 +300,15 @@ def insert_lab_test_to_medical_record(doc):
elif doc.special_test_items:
item = doc.special_test_items[0]
table_row = item.lab_test_particulars +" "+ item.result_value
if item.lab_test_particulars and item.result_value:
table_row = item.lab_test_particulars +" "+ item.result_value
elif doc.sensitivity_test_items:
item = doc.sensitivity_test_items[0]
table_row = item.antibiotic +" "+ item.antibiotic_sensitivity
if item.antibiotic and item.antibiotic_sensitivity:
table_row = item.antibiotic +" "+ item.antibiotic_sensitivity
if table_row:
subject += "<br/>"+table_row

View File

@ -14,8 +14,6 @@ source_link = "https://github.com/frappe/erpnext"
develop_version = '12.x.x-develop'
error_report_email = "support@erpnext.com"
app_include_js = "assets/js/erpnext.min.js"
app_include_css = "assets/css/erpnext.css"
web_include_js = "assets/js/erpnext-web.min.js"

View File

@ -122,6 +122,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "employee.employee_name",
"fieldname": "employee_name",
"fieldtype": "Read Only",
"hidden": 0,
@ -461,7 +462,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2019-03-08 12:00:14.043535",
"modified": "2019-06-05 12:00:14.043535",
"modified_by": "Administrator",
"module": "HR",
"name": "Attendance",

View File

@ -7,7 +7,6 @@ import frappe
from frappe.utils import getdate, nowdate
from frappe import _
from frappe.model.document import Document
from erpnext.hr.utils import set_employee_name
from frappe.utils import cstr
class Attendance(Document):
@ -18,8 +17,6 @@ class Attendance(Document):
if res:
frappe.throw(_("Attendance for employee {0} is already marked").format(self.employee))
set_employee_name(self)
def check_leave_record(self):
leave_record = frappe.db.sql("""select leave_type, half_day, half_day_date from `tabLeave Application`
where employee = %s and %s between from_date and to_date and status = 'Approved'

View File

@ -446,7 +446,7 @@ class SalarySlip(TransactionBase):
else:
component_row.additional_amount = amount
if not overwrite:
if not overwrite and component_row.default_amount:
amount += component_row.default_amount
component_row.amount = amount

View File

@ -192,6 +192,15 @@
"fieldtype": "Text",
"label": "Other Details"
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Travel Request",
"print_hide": 1,
"read_only": 1
},
{
"collapsible": 1,
"fieldname": "accounting_dimensions_section",
@ -203,6 +212,7 @@
"fieldtype": "Column Break"
}
],
"is_submittable": 1,
"modified": "2019-05-25 23:15:00.609186",
"modified_by": "Administrator",
"module": "HR",

View File

@ -2,7 +2,7 @@
// For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["BOM Items and Scraps"] = {
frappe.query_reports["BOM Explorer"] = {
"filters": [
{
fieldname: "bom",

View File

@ -1,20 +1,20 @@
{
"add_total_row": 0,
"creation": "2019-05-14 12:06:14.998746",
"creation": "2019-06-06 15:42:53.021714",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
"modified": "2019-05-14 12:06:14.998746",
"modified": "2019-06-06 15:42:53.021714",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Items and Scraps",
"name": "BOM Explorer",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "BOM",
"report_name": "BOM Items and Scraps ",
"report_name": "BOM Explorer",
"report_type": "Script Report",
"roles": [
{

View File

@ -603,4 +603,5 @@ erpnext.patches.v11_1.rename_depends_on_lwp
execute:frappe.delete_doc("Report", "Inactive Items")
erpnext.patches.v11_1.delete_scheduling_tool
erpnext.patches.v12_0.make_custom_fields_for_bank_remittance
execute:frappe.delete_doc_if_exists("Page", "support-analytics")
execute:frappe.delete_doc_if_exists("Page", "support-analytics")
erpnext.patches.v12_0.make_item_manufacturer

View File

@ -40,7 +40,7 @@ def execute():
# This is probably never used anywhere else as of now, but should be
values = []
for d in batch_transactions:
values.append("('{}', {})".format(d.parent, d.qty))
values.append("({0}, {1})".format(frappe.db.escape(d.parent), d.qty))
conditions = ",".join(values)
frappe.db.sql("""
INSERT INTO `tab{}` (name, total_qty) VALUES {}

View File

@ -0,0 +1,27 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("stock", "doctype", "item_manufacturer")
item_manufacturer = []
for d in frappe.db.sql(""" SELECT name, manufacturer, manufacturer_part_no, creation, owner
FROM `tabItem` WHERE manufacturer is not null and manufacturer != ''""", as_dict=1):
item_manufacturer.append((
frappe.generate_hash("", 10),
d.name,
d.manufacturer,
d.manufacturer_part_no,
d.creation,
d.owner
))
if item_manufacturer:
frappe.db.sql('''
INSERT INTO `tabItem Manufacturer`
(`name`, `item_code`, `manufacturer`, `manufacturer_part_no`, `creation`, `owner`)
VALUES {}'''.format(', '.join(['%s'] * len(item_manufacturer))), tuple(item_manufacturer)
)

View File

@ -55,8 +55,5 @@
"stock/dashboard/item_dashboard.html",
"stock/dashboard/item_dashboard_list.html",
"stock/dashboard/item_dashboard.js"
],
"js/lms.min.js": [
"public/js/education/lms/lms.js"
]
}

View File

@ -14,8 +14,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
this._super();
},
onload: function() {
this.setup_queries();
onload: function(doc, cdt, cdn) {
this.setup_queries(doc, cdt, cdn);
this._super();
this.frm.set_query('shipping_rule', function() {
@ -50,7 +50,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
/* eslint-enable */
},
setup_queries: function() {
setup_queries: function(doc, cdt, cdn) {
var me = this;
if(this.frm.fields_dict.buying_price_list) {
@ -90,6 +90,15 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}
}
});
this.frm.set_query("manufacturer", "items", function(doc, cdt, cdn) {
const row = locals[cdt][cdn];
return {
query: "erpnext.controllers.queries.item_manufacturer_query",
filters:{ 'item_code': row.item_code }
}
});
},
refresh: function(doc) {
@ -338,6 +347,25 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}
})
}
},
manufacturer: function(doc, cdt, cdn) {
const row = locals[cdt][cdn];
if(row.manufacturer) {
frappe.call({
method: "erpnext.stock.doctype.item_manufacturer.item_manufacturer.get_item_manufacturer_part_no",
args: {
'item_code': row.item_code,
'manufacturer': row.manufacturer
},
callback: function(r) {
if (r.message) {
frappe.model.set_value(cdt, cdn, 'manufacturer_part_no', r.message);
}
}
});
}
}
});

View File

@ -460,6 +460,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
weight_per_unit: item.weight_per_unit,
weight_uom: item.weight_uom,
uom : item.uom,
manufacturer: item.manufacturer,
stock_uom: item.stock_uom,
pos_profile: me.frm.doc.doctype == 'Sales Invoice' ? me.frm.doc.pos_profile : '',
cost_center: item.cost_center,

View File

@ -1,15 +0,0 @@
frappe.ready(() => {
frappe.provide('lms');
lms.call = (method, args) => {
const method_path = 'erpnext.www.lms.' + method;
return new Promise((resolve, reject) => {
return frappe.call({
method: method_path,
args,
})
.then(r => resolve(r.message))
.fail(reject);
});
};
});

View File

@ -1,44 +0,0 @@
<template>
<div>
<ContentTitle :title="contentData.title" :author="contentData.author" :publishDate="contentData.publish_date">
<slot></slot>
</ContentTitle>
<section class="article-content-section">
<div>
<div class="content" v-html="contentData.content"></div>
<div class="text-right">
</div>
<div class="mt-3 text-right">
<a class="text-muted" href="/report"><i class="octicon octicon-issue-opened" title="Report"></i> Report a
Mistake</a>
</div>
</div>
</section>
</div>
</template>
<script>
import ContentTitle from './ContentTitle.vue'
export default {
props: ['content', 'type'],
name: 'Article',
data() {
return {
contentData: ''
}
},
mounted() {
this.getContent().then(data => this.contentData = data);
},
methods: {
getContent() {
return lms.call('get_content', {
content_type: this.type,
content: this.content
})
}
},
components: {
ContentTitle
}
};
</script>

View File

@ -1,56 +0,0 @@
<template>
<div>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li v-for="(route, index) in routeData" class="breadcrumb-item active" aria-current="page">
<router-link v-if="index != routeData.length - 1" :to="route.route">
{{ route.label }}
</router-link>
<span v-else>{{ route.label }}</span>
</li>
</ol>
</nav>
</div>
</template>
<script type="text/javascript">
export default {
name: "Breadcrumb",
data() {
return {
routeName: this.$route.name,
routeParams: this.$route.params,
routeData: [{
label: "All Programs",
route: "/List/Program"
}]
}
},
mounted() {
this.buildBreadcrumb()
},
methods: {
buildBreadcrumb() {
if(this.routeName == 'program') {
return
}
if(this.routeName == 'course') {
let routeObject = {
label: this.routeParams.program_name,
route: `/Program/${this.routeParams.program_name}`
}
this.routeData.push(routeObject)
}
if(this.routeName == 'content') {
this.routeData.push({
label: this.routeParams.program_name,
route: `/Program/${this.routeParams.program_name}`
})
this.routeData.push({
label: this.routeParams.course_name,
route: `/Program/${this.routeParams.program_name}/${this.routeParams.course_name}`
})
}
}
}
};
</script>

View File

@ -1,25 +0,0 @@
<template>
<button :class="classList" v-on="$listeners" v-bind="$attrs" @click="goToRoute">
<slot></slot>
</button>
</template>
<script>
export default {
name: 'AButton',
props: ['type', 'size', 'route'],
computed: {
classList() {
return [
'btn',
'btn-' + this.type,
'btn-' + this.size
]
}
},
methods: {
goToRoute() {
this.$router.push(this.route);
}
}
}
</script>

View File

@ -1,28 +0,0 @@
<template>
<div class="featured-products-section py-3">
<h5 class='featured-heading' v-html="title"></h5>
<div class="featured-products row">
<!-- <p class='lead text-center' v-html="description"></p> -->
<slot name="card-list-slot"></slot>
</div>
<div class='mt-4 text-center'>
<slot name="list-bottom"></slot>
</div>
</div>
</template>
<script>
export default {
props:['title', 'description'],
name: "CardList",
};
</script>
<style scoped>
.featured-heading {
text-transform: uppercase;
letter-spacing: 0.5px;
font-size: 12px;
font-weight: 500;
}
</style>

View File

@ -1,40 +0,0 @@
<template>
<div class="nav-buttons">
<button class='btn btn-outline-secondary' @click="$router.go(-1)">Back</button>
<button v-if="nextContent" class='btn btn-primary' @click="goNext()">Next</button>
<button v-else class='btn btn-primary' @click="finish()">Finish Topic</button>
</div>
</template>
<script>
export default {
props: ['nextContent', 'nextContentType'],
name: 'ContentNavigation',
methods: {
addActivity() {
if(this.$route.params.type != "Quiz"){
console.log("Adding Activity")
lms.call("add_activity",
{
course: this.$route.params.course_name,
content_type: this.$route.params.type,
content: this.$route.params.content,
}
)
}
},
goNext() {
this.addActivity()
this.$router.push({ name: 'content', params: { course: this.$route.params.course_name, type:this.nextContentType, content:this.nextContent }})
},
finish() {
this.addActivity()
this.$router.push({ name: 'course', params: { program_name: this.$route.params.program_name, course_name: this.$route.params.course_name}})
lms.trigger('course-completed', course_name);
}
}
};
</script>
<style lang="css" scoped>
</style>

View File

@ -1,29 +0,0 @@
<template>
<section class='article-top-section video-section-bg'>
<div>
<div class="row">
<div class="col-md-8">
<h2>{{ title }}</h2>
<span v-if="typeof author !== 'undefined' || author !== null" class="text-muted">
<span v-if="publishDate">Published on {{ publishDate }}</span>
<span v-if="author"> {{ author }}</span>
</span>
</div>
<div class="col-md-4 text-right">
<slot></slot>
</div>
</div>
<hr>
</div>
</section>
</template>
<script>
export default {
props: ['title', 'publishDate', 'author'],
name: 'ContentTitle',
};
</script>
<style lang="css" scoped>
</style>

View File

@ -1,87 +0,0 @@
<template>
<div class="py-3 col-md-4 col-sm-12">
<div class="card h-100">
<div class="card-hero-img" v-if="course.hero_image" v-bind:style="{ 'background-image': 'url(' + image + ')' }"></div>
<div v-else class="card-image-wrapper">
<div class="image-body">{{ course.course_name }}</div>
</div>
<div class='card-body'>
<h5 class="card-title">{{ course.course_name }}</h5>
<span class="course-list text-muted" id="getting-started">
{{ course.course_intro.substring(0,120) }}
</span>
</div>
<div class='p-3' style="display: flex; justify-content: space-between;">
<div>
<span v-if="complete"><i class="mr-2 text-success fa fa-check-circle" aria-hidden="true"></i>Course Complete</span>
</div>
<div class='text-right'>
<a-button
:type="'primary'"
size="sm"
:route="courseRoute"
>
{{ buttonName }}
</a-button>
</div>
</div>
</div>
</div>
</template>
<script>
import AButton from './Button.vue';
export default {
props: ['course', 'program_name'],
name: "CourseCard",
components: {
AButton
},
data() {
return {
courseDetails: {},
}
},
mounted() {
if(lms.store.checkLogin()) this.getCourseDetails().then(data => this.courseDetails = data)
},
computed: {
courseRoute() {
return `${this.program_name}/${this.course.name}`
},
complete() {
if(lms.store.checkProgramEnrollment(this.program_name)){
if (this.courseDetails.flag === "Completed" ) {
return true
}
else {
return false
}
}
else {
return false
}
},
isLogin() {
return lms.store.checkLogin()
},
buttonName() {
if(lms.store.checkProgramEnrollment(this.program_name)){
return "Start Course"
}
else {
return "Explore"
}
}
},
methods: {
getCourseDetails() {
return lms.call('get_student_course_details', {
course_name: this.course.name,
program_name: this.program_name
})
},
}
};
</script>

View File

@ -1,85 +0,0 @@
<template>
<nav class="navbar navbar-light bg-white navbar-expand-lg sticky-top shadow-sm">
<div class="container">
<a class="navbar-brand" href="/lms">
<span>{{ portal.title }}</span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="lms#/List/Program">
All Programs
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/lms#/Profile">
Profile
</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<!-- post login tools -->
<li v-if="isLogin" class="nav-item dropdown logged-in" id="website-post-login" data-label="website-post-login">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="user-image-wrapper">
<span class="avatar avatar-small" :title="fullName">
<span class="avatar-frame" :style="avatarStyle" :title="fullName"></span>
</span>
</span>
<span class="full-name">{{ fullName }}</span>
<b class="caret"></b>
</a>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<a class="dropdown-item" href="/me" rel="nofollow"> My Account </a>
<a class="dropdown-item" href="/?cmd=web_logout" rel="nofollow"> Logout </a>
</ul>
</li>
<li v-else class="nav-item">
<a class="nav-link btn-login-area" href="/login">Login</a>
</li>
</ul>
</div>
</div>
</nav>
</template>
<script>
export default {
name: "Home",
data() {
return{
portal: {},
avatar: frappe.user_image,
fullName: frappe.full_name,
isLogin: frappe.is_user_logged_in()
}
},
mounted() {
this.getPortalDetails().then(data => this.portal = data);
},
methods: {
getPortalDetails() {
return lms.call("get_portal_details")
}
},
computed: {
avatarStyle() {
return `background-image: url("${this.avatar}")`
},
// isLogin() {
// return frappe.is_user_logged_in()
// },
}
};
</script>
<style scoped>
a {
text-decoration: none;
}
</style>

View File

@ -1,83 +0,0 @@
<template>
<div class="py-5">
<div class="row">
<div class="col-sm-12">
<div>
<h3>{{ fullName }}</h3>
<ul>
<li class="row">
<div class="col-md-3 col-sm-4 pr-0 text-muted">Email:</div>
<div class="col-md-9 col-sm-8">{{ email }}</div>
</li>
<li v-if="joiningDate" class="row">
<div class="col-md-3 col-sm-4 pr-0 text-muted">Date of Joining:</div>
<div class="col-md-9 col-sm-8">{{ joiningDate }}</div>
</li>
<li class="row">
<div class="col-md-3 col-sm-4 pr-0 text-muted">Programs Enrolled:</div>
<div class="col-md-9 col-sm-8">
<ul v-if="enrolledPrograms">
<li v-for="program in enrolledPrograms" :key="program">{{ program }}</li>
</ul>
<span v-else>None</span>
</div>
</li>
</ul>
</div>
<a href="/update-profile" class="edit-button text-muted">Edit Profile</a>
</div>
</div>
<div ></div>
</div>
</template>
<script>
export default {
props: ['enrolledPrograms'],
name: "ProfileInfo",
data() {
return {
avatar: frappe.user_image,
fullName: frappe.full_name,
abbr: frappe.get_abbr(frappe.get_cookie("full_name")),
email: frappe.session.user,
joiningDate: ''
}
},
mounted(){
this.getJoiningDate().then(data => {
if(data) {
this.joiningDate = lms.moment(String(data)).format('D MMMM YYYY')
}
})
},
computed: {
avatarStyle() {
return `background-image: url("${this.avatar}")`
},
},
methods: {
getJoiningDate() {
return lms.call("get_joining_date")
}
}
};
</script>
<style scoped>
.edit-button {
position: absolute;
top: 0;
right: 0;
}
.standard-image {
font-size: 72px;
border-radius: 6px;
}
ul {
list-style-type: none;
padding: 0;
margin: 0
}
</style>

View File

@ -1,82 +0,0 @@
<template>
<div class='py-3 col-md-4 col-sm-12'>
<div class="card h-100">
<router-link :to="'/Program/' + program.name">
<div class="card-hero-img" v-if="program.hero_image" v-bind:style="{ 'background-image': 'url(' + image + ')' }"></div>
<div v-else class="card-image-wrapper text-center">
<div class="image-body">{{ program.program_name }}</div>
</div>
<div class='card-body'>
<h5 class='card-title'>{{ program.program_name }}</h5>
<div class="text-muted">{{ program.description.substring(0,120) }}...</div>
</div>
</router-link>
<div class='text-right p-3'>
<button v-if="program.intro_video" class='btn btn-light btn-sm' data-toggle="modal" data-target="#videoModal">Watch Intro</button>
<a-button v-if="enrolled" type="dark" size="sm" :route="programPageRoute">
{{ buttonName }}
</a-button>
<button v-else-if="isLogin" class='btn btn-dark btn-sm' @click="enroll()">{{ enrollButton }}</button>
<a v-else class='btn btn-secondary btn-sm' href="/login#signup">Sign Up</a>
</div>
<VideoModal v-if="program.intro_video" :title="program.program_name" :video="program.intro_video"/>
</div>
</div>
</template>
<script>
import AButton from './Button.vue';
import VideoModal from './VideoModal.vue';
export default {
props: ['program', 'enrolled'],
name: "ProgramCard",
data() {
return {
isLogin: frappe.is_user_logged_in(),
enrollButton: 'Enroll Now',
programRoute: { name: 'program', params: { program_name: this.program.name }},
image: "'" + this.program.hero_image + "'"
};
},
methods: {
enroll() {
this.enrollButton = 'Enrolling...'
lms.call('enroll_in_program', {
program_name: this.program.name,
}).then(data => {
lms.store.updateEnrolledPrograms()
this.$router.push(this.programRoute)
})
}
},
computed: {
buttonName() {
if(this.enrolled){
return "Start Program"
}
else {
return "Enroll"
}
},
programPageRoute() {
return this.programRoute
},
isEnrolled() {
return lms.store.enrolledPrograms.includes(this.program.name)
}
},
components: {
AButton,
VideoModal
}
};
</script>
<style lang="css" scoped>
a {
text-decoration: none;
color: black;
}
a.btn-secondary {
color: white !important;
}
</style>

View File

@ -1,89 +0,0 @@
<template>
<div class='py-3 col-md-4 col-sm-12'>
<div class="card h-100">
<div class='card-body'>
<router-link :to="'/Program/' + programData.name">
<h5 class='card-title'>{{ programData.program }}</h5>
</router-link>
<span class="course-list text-muted" id="getting-started">
Courses
<ul class="mb-0 mt-1 list-unstyled" style="padding-left: 1.5em;">
<li v-for="item in programData.progress" :key="item.name">
<span v-if="item.is_complete"><i class="text-success fa fa-check-circle" aria-hidden="true"></i></span>
<span v-else><i class="text-secondary fa fa-circle-o" aria-hidden="true"></i></span>
{{ item.course_name }}
</li>
</ul>
</span>
</div>
<div class='p-3' style="display: flex; justify-content: space-between;">
<div></div>
<div class='text-right'>
<a-button
:type="buttonType"
size="sm btn-block"
:route="programRoute"
>
{{ buttonName }}
</a-button>
</div>
</div>
</div>
</div>
</template>
<script>
import AButton from './Button.vue';
export default {
props: ['program'],
name: "ProgressCard",
data() {
return {
programData: {}
};
},
mounted() {
this.getProgramProgress().then(data => this.programData = data)
},
methods: {
getProgramProgress() {
return lms.call('get_program_progress', {
program_name: this.program
})
},
},
computed: {
programRoute() {
return {name: 'program', params: {program_name: this.program}}
},
buttonType() {
if (this.programData.percentage == 100 ){
return "success"
}
else if (this.programData.percentage == "0" ) {
return "secondary"
}
else {
return "info"
}
},
buttonName() {
if (this.programData.percentage == 100 ){
return "Program Complete"
}
else {
return `${this.programData.percentage}% Completed`
}
}
},
components: {
AButton
},
};
</script>
<style scoped>
a {
text-decoration: none;
color: black;
}
</style>

View File

@ -1,119 +0,0 @@
<template>
<section class="quiz-section">
<div>
<div class="row">
<div class="col-md-8">
<h2>{{ content }}</h2>
</div>
</div>
<div class="content">
<hr>
<div id="quiz" :name="content">
<div id="quiz-body">
<component v-for="question in quizData" :key="question.name" v-bind:is="question.type" :question="question" @updateResponse="updateResponse" :isDisabled="isDisabled"></component>
</div>
<div class="mt-3">
<div>
<div v-if="isDisabled || submitted" id="post-quiz-actions" class="row">
<div class="col-md-8 text-left">
<span v-html="message"></span>
</div>
<div class="col-md-4 text-right">
<slot></slot>
</div>
</div>
<div v-else id="quiz-actions" class="text-right">
<button class='btn btn-outline-secondary' type="reset" :disabled="isDisabled">Reset</button>
<button class='btn btn-primary' @click="submitQuiz" type="button" :disabled="isDisabled">Submit</button>
</div>
</div>
</div>
</div>
</div>
<div class="mt-3 text-right">
<a class="text-muted" href="/report"><i class="octicon octicon-issue-opened" title="Report"></i> Report a
Mistake</a>
</div>
</div>
</section>
</template>
<script>
import QuizSingleChoice from "./Quiz/QuizSingleChoice.vue"
import QuizMultipleChoice from "./Quiz/QuizMultipleChoice.vue"
export default {
props: ['content', 'type'],
name: 'Quiz',
data() {
return {
quizData: '',
quizResponse: {},
score: '',
submitted: false,
isDisabled: false,
quizStatus: {},
}
},
mounted() {
this.getQuizWithoutAnswers().then(data => {
this.quizData = data.quizData
this.quizStatus = data.status
this.isDisabled = data.status.is_complete
});
},
components: {
'SingleChoice': QuizSingleChoice,
'MultipleChoice': QuizMultipleChoice
},
methods: {
getQuizWithoutAnswers() {
return lms.call("get_quiz_without_answers",
{
quiz_name: this.content,
course_name: this.$route.params.course_name
}
)
},
updateResponse(res) {
this.quizResponse[res.question] = res.option
},
submitQuiz() {
lms.call("evaluate_quiz",
{
quiz_response: this.quizResponse,
quiz_name: this.content,
course: this.$route.params.course_name
}
).then(data => {
this.score = data
this.submitted = true
this.quizResponse = null
});
}
},
computed: {
currentComponent: function() {
if(this.quizData.type === "MultipleChoice") {
return 'QuizMultipleChoice'
}
else {
return 'QuizSingleChoice'
}
},
message: function() {
if(this.submitted) {
return '<h3>Your Score: <span id="result">'+ this.score +'</span></h3>'
}
let message = '<h4>You have exhausted all attempts for this quiz.</h4>'
if(this.quizStatus.result == 'Pass') {
message = "<h4>You have successfully completed this quiz.</h4>Score: " + this.quizStatus.score
}
return message
}
},
};
</script>
<style lang="css" scoped>
</style>

View File

@ -1,34 +0,0 @@
<template>
<div class="question mt-4">
<h5>{{ question.question }}</h5>
<div class="options ml-2">
<div v-for="option in question.options" :key="option.name" class="form-check pb-1">
<input v-model="checked" class="form-check-input" type="checkbox" :name="question.name" :id="option.name" :value="option.name" @change="emitResponse(question.name, option.name)" :disabled="isDisabled">
<label class="form-check-label" :for="option.name">
{{ option.option }}
</label>
</div>
</div>
</div>
</template>
<script>
export default {
props: ['question', 'isDisabled'],
name: 'QuizSingleChoice',
data() {
return {
checked: []
}
},
methods: {
emitResponse(q, o) {
console.log(this.checked)
this.$emit('updateResponse', {'question':q , 'option': this.checked, 'type': this.question.type})
}
}
};
</script>
<style lang="css" scoped>
</style>

View File

@ -1,28 +0,0 @@
<template>
<div class="question mt-4">
<h5>{{ question.question }}</h5>
<div class="options ml-2">
<div v-for="option in question.options" :key="option.name" class="form-check pb-1">
<input class="form-check-input" type="radio" :name="question.name" :id="option.name" :value="option.name" @change="emitResponse(question.name, option.name)" :disabled="isDisabled">
<label class="form-check-label" :for="option.name">
{{ option.option }}
</label>
</div>
</div>
</div>
</template>
<script>
export default {
props: ['question', 'isDisabled'],
name: 'QuizSingleChoice',
methods: {
emitResponse(q, o) {
this.$emit('updateResponse', {'question':q , 'option': o, 'type': this.question.type})
}
}
};
</script>
<style lang="css" scoped>
</style>

View File

@ -1,60 +0,0 @@
<template>
<div v-if="quizData" class='py-3 col-md-4 col-sm-12'>
<div class="card h-100">
<div class='card-body'>
<h5 class='card-title'>{{ quizData.program }}</h5>
<div v-for="attempt in quizData.quiz_attempt" :key="attempt.content" class="course-list" id="getting-started">
<div>
{{ attempt.content }}
<ul v-if="attempt.is_complete">
<li><span class="text-muted">Score: </span>{{ attempt.score }}</li>
<li><span class="text-muted">Status: </span>{{attempt.result }}</li>
</ul>
<span v-else>- Unattempted</span>
</div>
</div>
</div>
<div class='p-3' style="display: flex; justify-content: space-between;">
<div></div>
<div class='text-right'>
<a-button
:type="'primary'"
size="sm btn-block"
:route="programRoute"
>
Go To Program
</a-button>
</div>
</div>
</div>
</div>
</template>
<script>
import AButton from './Button.vue';
export default {
props: ['program'],
name: "ScoreCard",
data() {
return {
quizData: {}
};
},
mounted() {
this.getQuizProgress().then(data => this.quizData = data)
},
methods: {
getQuizProgress() {
return lms.call('get_quiz_progress_of_program', {
program_name: this.program
})
},
programRoute() {
return {name: 'program', params: {program_name: this.program}}
},
},
components: {
AButton
},
};
</script>

View File

@ -1,27 +0,0 @@
<template>
<div class="hero">
<h1 class="text-center" v-html="title"></h1>
<p class='text-center' v-html="description"></p>
<p class="text-center padding">
<slot></slot>
</p>
</div>
</template>
<script>
export default {
props: ['title', 'description'],
name: "TopSection",
};
</script>
<style scoped>
.hero {
padding-top: 50px;
padding-bottom: 100px;
}
.hero h1 {
font-size: 40px;
font-weight: 200;
}
</style>

View File

@ -1,49 +0,0 @@
<template>
<button v-if="isLoggedIn" class='btn btn-primary btn-md' @click="primaryAction()">{{ buttonName }}</button>
<a v-else class='btn btn-primary btn-md' href="/login#signup">{{ buttonName }}</a>
</template>
<script>
export default {
name: "TopSectionButton",
data() {
return {
buttonName: '',
isLoggedIn: lms.store.checkLogin(),
nextContent: '',
nextContentType: '',
nextCourse: '',
link: '',
}
},
mounted() {
this.computeButtons()
},
methods: {
computeButtons(){
if(this.isLoggedIn){
this.buttonName = 'Explore Programs'
}
else{
this.buttonName = 'Sign Up'
}
},
primaryAction() {
if(this.$route.name == 'home'){
this.$router.push('List/Program');
}
else if(this.$route.name == 'program' && lms.store.enrolledPrograms.includes(this.$route.params.program_name)){
this.$router.push({ name: 'content', params: { program_name: this.$route.params.program_name, course: this.nextCourse, type: this.nextContentType, content: this.nextContent}})
}
else {
lms.call("enroll_in_program",
{
program_name: this.$route.params.program_name,
student_email_id: frappe.session.user
}
)
lms.store.updateEnrolledPrograms()
}
},
}
};
</script>

View File

@ -1,112 +0,0 @@
<template>
<div class="py-3 col-md-4 col-sm-12">
<div class="card h-100">
<div class="card-hero-img" v-if="topic.hero_image" v-bind:style="{ 'background-image': 'url(' + image + ')' }"></div>
<div v-else class="card-image-wrapper">
<div class="image-body">{{ topic.topic_name }}</div>
</div>
<div class='card-body'>
<h5 class="card-title">{{ topic.topic_name }}</h5>
<span class="course-list text-muted" id="getting-started">
Content
<ul class="mb-0 mt-1" style="padding-left: 1.5em;">
<li v-for="content in topic.topic_content" :key="content.name">
<router-link v-if="isLogin" tag="a" :class="'text-muted'" :to="{name: 'content', params:{program_name: program_name, topic:topic.name, course_name: course_name, type:content.content_type, content: content.content} }">
{{ content.content }}
</router-link>
<div v-else><span style="padding-right: 0.4em"></span>{{ content.content }}</div>
</li>
</ul>
</span>
</div>
<div v-if="isLogin" class='p-3' style="display: flex; justify-content: space-between;">
<div>
<span v-if="complete"><i class="mr-2 text-success fa fa-check-circle" aria-hidden="true"></i>Course Complete</span>
</div>
<div class='text-right'>
<a-button
:type="'primary'"
size="sm"
:route="firstContentRoute"
>
{{ buttonName }}
</a-button>
</div>
</div>
</div>
</div>
</template>
<script>
import AButton from './Button.vue';
export default {
props: ['topic', 'course_name', 'program_name'],
name: "TopicCard",
data() {
return {
topicDetails: {}
}
},
mounted() {
if(lms.store.checkLogin()) this.gettopicDetails().then(data => this.topicDetails = data)
},
components: {
AButton
},
computed: {
firstContentRoute() {
if(lms.store.checkLogin()){
return `/Program/${this.program_name}/${this.course_name}/${this.topic.name}/${this.topicDetails.content_type}/${this.topicDetails.content}`
}
else {
return {}
}
},
complete() {
if(lms.store.checkProgramEnrollment(this.program_name)){
if (this.topicDetails.flag === "Completed" ) {
return true
}
else {
return false
}
}
else {
return false
}
},
isLogin() {
// return lms.store.checkProgramEnrollment(this.program_name)
return lms.store.checkLogin()
},
buttonName() {
if(lms.store.checkProgramEnrollment(this.program_name)){
if (this.topicDetails.flag == 'Continue'){
return 'Continue'
}
else {
return 'Start Topic'
}
}
else {
return "Explore"
}
}
},
methods: {
iconClass(content_type) {
if(content_type == 'Video') return 'fa fa-play'
if(content_type == 'Article') return 'fa fa-file-text-o'
if(content_type == 'Quiz') return 'fa fa-question-circle-o'
},
gettopicDetails() {
return lms.call('get_student_topic_details', {
topic_name: this.topic.name,
course_name: this.course_name,
})
},
}
};
</script>

View File

@ -1,63 +0,0 @@
<template>
<div>
<div class='mt-2'>
<div>
<div class="mt-3 row">
<div class="col-md-8">
<h2>{{ contentData.name }}</h2>
<span class="text-muted">
<i class="octicon octicon-clock" title="Duration"></i> <span v-if="contentData.duration"> {{ contentData.duration }} Mins &mdash; </span><span v-if="contentData.publish_date"> Published on {{ contentData.publish_date }}. </span>
</span>
</div>
<div class="col-md-4 text-right">
<slot></slot>
</div>
</div>
<youtube-player :url="contentData.url" class="mt-3"/>
<hr>
</div>
</div>
<div class="video-description-section">
<div>
<div class="content" v-html="contentData.description">
</div>
<div class="text-right hidden">
<a class='btn btn-outline-secondary' href="/classrooms/module">Previous</a>
<a class='btn btn-primary' href="/classrooms/module">Next</a>
</div>
<div class="mt-3 text-right">
<a class="text-muted" href="/report"><i class="octicon octicon-issue-opened" title="Report"></i> Report a
Mistake</a>
</div>
</div>
</div>
</div>
</template>
<script>
import YoutubePlayer from './YoutubePlayer.vue'
export default {
props: ['content', 'type'],
name: 'Video',
data() {
return {
contentData: '',
}
},
components: {
YoutubePlayer
},
mounted() {
this.getContent()
.then(data => this.contentData = data)
},
methods: {
getContent() {
return lms.call('get_content', {
content_type: this.type,
content: this.content
})
}
}
};
</script>

View File

@ -1,35 +0,0 @@
<template>
<div class="modal" id="videoModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{ title }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span id="close_modal" aria-hidden="true" @click="stopVideo()">&times;</span>
</button>
</div>
<div class="modal-body">
<youtube-player :url="video"/>
</div>
</div>
</div>
</div>
</template>
<script type="text/javascript">
import YoutubePlayer from './YoutubePlayer.vue'
export default {
name: 'VideoModal',
props: ['title', 'video'],
components: {
YoutubePlayer
},
methods: {
stopVideo() {
$('.yvideo').each(function() {
this.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}', '*')
});
}
}
};
</script>

View File

@ -1,36 +0,0 @@
<template>
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item yvideo" :src="'https://www.youtube.com/embed/' + videoID + '?version=3&enablejsapi=1'" allowfullscreen></iframe>
</div>
</template>
<script type="text/javascript">
export default {
name: 'YoutubePlayer',
props: ['url'],
data() {
return {
videoID: ''
}
},
watch: {
url() {
this.videoID = this.getVideoID(this.url)
}
},
methods: {
getVideoID(link) {
if (!Array.prototype.last){
Array.prototype.last = function(){
return this[this.length - 1];
};
};
if (link.includes('v=')){
return link.split('v=')[1].split('&')[0]
}
else if (link.includes('youtu.be')) {
return link.split('/').last().split('?')[0]
}
}
}
};
</script>

View File

@ -1,81 +0,0 @@
import Vue from 'vue/dist/vue.js';
import VueRouter from 'vue-router/dist/vue-router.js';
import moment from 'moment/min/moment.min.js';
import lmsRoot from "./lmsRoot.vue";
import routes from './routes';
import './call';
Vue.use(VueRouter);
var store = {
enrolledPrograms: [],
enrolledCourses: []
};
// let profile_page = `<a class="dropdown-item" href="/lms#/Profile" rel="nofollow"> LMS Profile </a>`
// document.querySelector('#website-post-login > ul').innerHTML += profile_page
frappe.ready(() => {
frappe.provide('lms');
lms.moment = moment;
lms.store = new Vue({
data: store,
methods: {
updateEnrolledPrograms() {
if(this.checkLogin()) {
lms.call("get_program_enrollments").then(data => {
this.enrolledPrograms = data;
});
}
},
updateEnrolledCourses() {
if(this.checkLogin()) {
lms.call("get_all_course_enrollments").then(data => {
this.enrolledCourses = data;
});
}
},
checkLogin() {
return frappe.is_user_logged_in();
},
updateState() {
this.checkLogin();
this.updateEnrolledPrograms();
this.updateEnrolledCourses();
},
checkProgramEnrollment(programName) {
if(this.checkLogin()){
if(this.enrolledPrograms) {
if(this.enrolledPrograms.includes(programName)) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
else {
return false;
}
}
}
});
lms.view = new Vue({
el: "#lms-app",
router: new VueRouter({ routes }),
template: "<lms-root/>",
components: { lmsRoot },
mounted() {
lms.store.updateState();
}
});
lms.view.$router.afterEach((to, from) => {
window.scrollTo(0,0);
});
});

View File

@ -1,45 +0,0 @@
<template>
<div id="lms-root">
<navbar></navbar>
<main class="container my-5">
<div class="page_content">
<router-view :key="$route.fullPath"></router-view>
</div>
</main>
</div>
</template>
<script>
import Navbar from "./components/Navbar.vue"
export default {
name: "lmsRoot",
components: {
Navbar
}
};
</script>
<style>
div.card-hero-img {
height: 220px;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-color: rgb(250, 251, 252);
}
.card-image-wrapper {
display: flex;
overflow: hidden;
height: 220px;
background-color: rgb(250, 251, 252);
justify-content: center;
}
.image-body {
align-self: center;
color: #d1d8dd;
font-size: 24px;
font-weight: 600;
line-height: 1;
padding: 20px;
}
</style>

View File

@ -1,84 +0,0 @@
<template>
<div>
<component v-bind:is="currentComponent" :content="content" :type="type">
<ContentNavigation :nextContent="nextContent" :nextContentType="nextContentType"/>
</component>
</div>
</template>
<script>
import Article from "../components/Article.vue"
import Quiz from "../components/Quiz.vue"
import Video from "../components/Video.vue"
import ContentNavigation from "../components/ContentNavigation.vue"
export default {
props:['program_name', 'course_name', 'topic', 'type', 'content'],
name: "ContentPage",
data() {
return{
nextContent: '',
nextContentType: '',
}
},
computed: {
currentComponent: function() {
if(this.type === "Article") {
return 'Article'
}
else if(this.type === "Quiz") {
return 'Quiz'
}
else if(this.type === "Video") {
return 'Video'
}
},
},
mounted() {
this.getNextContent().then(data => {
this.nextContent = data.content,
this.nextContentType = data.content_type
});
},
methods: {
getNextContent(){
return lms.call("get_next_content",
{
current_content: this.content,
current_content_type: this.type,
topic: this.topic,
}
);
}
},
components: {
Article,
Video,
Quiz,
ContentNavigation
}
};
</script>
<style>
.footer-message {
display: none;
}
.video-description-section {
padding-top: 0em !important;
}
.article-top-section {
padding-top: 0.5em !important;
padding-bottom: 0rem !important;
}
.article-content-section {
padding-top: 0em !important;
}
.quiz-section {
padding-top: 0.5em !important;
padding-bottom: 0rem !important;
}
</style>

View File

@ -1,49 +0,0 @@
<template>
<div>
<breadcrumb></breadcrumb>
<TopSection v-bind:title="course.course_name" v-bind:description="course.course_intro">
</TopSection>
<CardList :title="'Topics'" :description="''">
<TopicCard slot="card-list-slot" v-for="topic in topicData" :topic="topic" :course_name="course_name" :program_name="program_name" :key="topic.name"/>
</CardList>
</div>
</template>
<script>
import TopSection from "../components/TopSection.vue"
import CardList from "../components/CardList.vue"
import TopicCard from "../components/TopicCard.vue"
import Breadcrumb from "../components/Breadcrumb.vue"
export default {
props: ['program_name','course_name'],
name: "CoursePage",
components: {
TopSection,
CardList,
TopicCard,
Breadcrumb
},
data() {
return {
course: {},
topicData: [],
}
},
mounted() {
this.getCourseDetails().then(data => this.course = data);
this.getTopics().then(data => this.topicData = data);
},
methods: {
getCourseDetails() {
return lms.call('get_course_details', {
course_name: this.course_name
});
},
getTopics() {
return lms.call('get_topics', {
course_name: this.course_name
})
}
}
};
</script>

View File

@ -1,48 +0,0 @@
<template>
<div>
<TopSection :title="portal.title" :description="portal.description">
<TopSectionButton/>
</TopSection>
<CardList :title="'Featured Programs'" :description="'Master ERPNext'">
<ProgramCard slot="card-list-slot" v-for="item in featuredPrograms" :key="item.program.name" :program="item.program" :enrolled="item.is_enrolled"/>
<AButton slot="list-bottom" :type="'primary'" :size="'md'" :route="'List/Program'">View All</AButton>
</CardList>
</div>
</template>
<script>
import Button from '../components/Button.vue';
import TopSection from "../components/TopSection.vue"
import CardList from "../components/CardList.vue"
import ProgramCard from "../components/ProgramCard.vue"
import TopSectionButton from "../components/TopSectionButton.vue"
export default {
name: "Home",
data() {
return{
portal: {},
featuredPrograms: {},
// enrolledPrograms: new Set()
}
},
components: {
AButton: Button,
TopSection,
CardList,
ProgramCard,
TopSectionButton
},
mounted() {
this.getPortalDetails().then(data => this.portal = data);
this.getFeaturedPrograms().then(data => this.featuredPrograms = data);
},
methods: {
getPortalDetails() {
return lms.call("get_portal_details")
},
getFeaturedPrograms() {
return lms.call("get_featured_programs")
}
}
};
</script>

View File

@ -1,53 +0,0 @@
<template>
<div>
<TopSection :title="'Programs at ' + portal.title" :description="portal.description">
<AButton v-if="isLogin" :type="'primary'" :size="'lg'" :route="{ name: 'signup'}">Sign Up</AButton>
</TopSection>
<CardList :title="'All Programs'" :description="''">
<ProgramCard slot="card-list-slot" v-for="item in masterData" :key="item.program.name" :program="item.program" :enrolled="item.is_enrolled"/>
</CardList>
</div>
</template>
<script>
import ProgramCard from '../components/ProgramCard.vue';
import CourseCard from "../components/CourseCard.vue"
import Button from '../components/Button.vue';
import TopSection from "../components/TopSection.vue"
import CardList from "../components/CardList.vue"
export default {
props: ['master'],
name: "ListPage",
components: {
AButton: Button,
CourseCard,
ProgramCard,
CardList,
TopSection
},
data() {
return {
portal: {},
masterData: {}
}
},
mounted() {
this.getPortalDetails().then(data => this.portal = data);
this.getMaster().then(data => this.masterData = data);
},
methods: {
getPortalDetails() {
return lms.call("get_portal_details")
},
getMaster() {
return lms.call("get_all_programs")
}
},
computed: {
isLogin() {
return !lms.store.checkLogin()
}
}
};
</script>

View File

@ -1,50 +0,0 @@
<template>
<div>
<ProfileInfo :enrolledPrograms="enrolledPrograms"></ProfileInfo>
<div v-if="enrolledPrograms">
<CardList :title="'Your Progress'" :description="''">
<ProgressCard slot="card-list-slot" v-for="program in enrolledPrograms" :program="program" :key="program"/>
</CardList>
<CardList :title="''" :description="''">
<ScoreCard slot="card-list-slot" v-for="program in enrolledPrograms" :program="program" :key="program"/>
</CardList>
</div>
<div v-else>
You haven't enrolled in any programs yet.
</div>
</div>
</template>
<script>
import Button from '../components/Button.vue';
import TopSection from "../components/TopSection.vue"
import CardList from "../components/CardList.vue"
import ProgressCard from "../components/ProgressCard.vue"
import ProfileInfo from "../components/ProfileInfo.vue"
import ScoreCard from "../components/ScoreCard.vue"
export default {
name: "ProfilePage",
components: {
AButton: Button,
TopSection,
CardList,
ProfileInfo,
ProgressCard,
ScoreCard
},
data() {
return {
enrolledPrograms: {},
}
},
mounted() {
this.getEnrolledPrograms().then(data => this.enrolledPrograms = data);
},
methods: {
getEnrolledPrograms() {
return lms.call("get_program_enrollments")
}
}
};
</script>

View File

@ -1,49 +0,0 @@
<template>
<div>
<breadcrumb></breadcrumb>
<TopSection v-bind:title="program.program_name" v-bind:description="program.description">
</TopSection>
<CardList :title="'Courses'" :description="''">
<CourseCard slot="card-list-slot" v-for="course in courseData" :course="course" :program_name="program_name" :key="course.name"/>
</CardList>
</div>
</template>
<script>
import TopSection from "../components/TopSection.vue"
import CardList from "../components/CardList.vue"
import CourseCard from "../components/CourseCard.vue"
import Breadcrumb from "../components/Breadcrumb.vue"
export default {
props: ['program_name'],
name: "ProgramPage",
components: {
TopSection,
CardList,
CourseCard,
Breadcrumb
},
data() {
return {
program: {},
courseData: [],
}
},
mounted() {
this.getProgramDetails().then(data => this.program = data);
this.getCourses().then(data => this.courseData = data);
},
methods: {
getProgramDetails() {
return lms.call('get_program', {
program_name: this.program_name
});
},
getCourses() {
return lms.call('get_courses', {
program_name: this.program_name
})
}
}
};
</script>

Some files were not shown because too many files have changed in this diff Show More