Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Not able to add lesson in timetable of the batch #842

Open
abhi-146 opened this issue May 27, 2024 · 1 comment
Open

Not able to add lesson in timetable of the batch #842

abhi-146 opened this issue May 27, 2024 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@abhi-146
Copy link

Steps to reproduce:

  1. Create a batch
  2. Create a lesson
  3. Try to add lesson in the timetable of the batch
Screenshot 2024-05-27 at 4 22 33 PM Screenshot 2024-05-27 at 4 22 05 PM

App Versions

{
	"erpnext": "15.23.0",
	"frappe": "15.26.0",
	"lms": "1.0.0"
}

Route

Form/LMS Batch/CLS-00011

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1768, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/form/save.py", line 39, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 373, in _save
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/lms/lms/lms/doctype/lms_batch/lms_batch.py", line 35, in validate
    self.validate_timetable()
  File "apps/lms/lms/lms/doctype/lms_batch/lms_batch.py", line 159, in validate_timetable
    if schedule.date < self.start_date or schedule.date > self.end_date:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'str'

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"name\":\"CLS-00011\",\"owner\":\"Administrator\",\"creation\":\"2024-05-27 15:02:23.116868\",\"modified\":\"2024-05-27 15:34:55.383226\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":0,\"title\":\"Nestorbird May\",\"start_date\":\"2024-05-01\",\"end_date\":\"2024-05-31\",\"start_time\":\"10:00:00\",\"end_time\":\"19:00:00\",\"published\":1,\"allow_self_enrollment\":0,\"medium\":\"Offline\",\"seat_count\":10,\"evaluation_end_date\":\"2024-05-31\",\"description\":\"Nestorbird May 2024 Interns\",\"batch_details\":\"<div class=\\\"ql-editor read-mode\\\"><p>Third batch of interns:</p><ol><li data-list=\\\"ordered\\\"><span class=\\\"ql-ui\\\" contenteditable=\\\"false\\\"></span>Rehan</li><li data-list=\\\"ordered\\\"><span class=\\\"ql-ui\\\" contenteditable=\\\"false\\\"></span>Zayn</li></ol></div>\",\"timetable_template\":\"\",\"show_live_class\":1,\"allow_future\":0,\"paid_batch\":0,\"amount\":0,\"currency\":\"INR\",\"amount_usd\":0,\"doctype\":\"LMS Batch\",\"timetable_legends\":[],\"assessment\":[{\"name\":\"mg19bc0sfj\",\"owner\":\"Administrator\",\"creation\":\"2024-05-27 15:02:23.116868\",\"modified\":\"2024-05-27 15:34:55.383226\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":1,\"assessment_type\":\"LMS Quiz\",\"assessment_name\":\"python-quiz\",\"parent\":\"CLS-00011\",\"parentfield\":\"assessment\",\"parenttype\":\"LMS Batch\",\"doctype\":\"LMS Assessment\"}],\"timetable\":[{\"docstatus\":0,\"doctype\":\"LMS Batch Timetable\",\"name\":\"new-lms-batch-timetable-pyknwvnruw\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"Administrator\",\"parent\":\"CLS-00011\",\"parentfield\":\"timetable\",\"parenttype\":\"LMS Batch\",\"idx\":1,\"__unedited\":false,\"reference_doctype\":\"Course Lesson\",\"reference_docname\":\"0005 DataTypes\",\"start_time\":\"10:00:00\",\"end_time\":\"11:00:00\"}],\"students\":[{\"name\":\"mfs79f5rgk\",\"owner\":\"Administrator\",\"creation\":\"2024-05-27 15:02:23.116868\",\"modified\":\"2024-05-27 15:34:55.383226\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":1,\"student\":\"rehan@yopmail.com\",\"student_name\":\"Rehan\",\"username\":\"rehan\",\"confirmation_email_sent\":1,\"parent\":\"CLS-00011\",\"parentfield\":\"students\",\"parenttype\":\"LMS Batch\",\"doctype\":\"Batch Student\"},{\"docstatus\":0,\"doctype\":\"Batch Student\",\"name\":\"n2u9pt0bdr\",\"__unsaved\":1,\"owner\":\"Administrator\",\"confirmation_email_sent\":1,\"parent\":\"CLS-00011\",\"parentfield\":\"students\",\"parenttype\":\"LMS Batch\",\"idx\":2,\"student_name\":\"Shaan \",\"username\":\"shaan_\",\"student\":\"shaan@yopmail.com\",\"creation\":\"2024-05-27 15:02:23.116868\",\"modified\":\"2024-05-27 15:34:55.383226\",\"modified_by\":\"Administrator\"},{\"docstatus\":0,\"doctype\":\"Batch Student\",\"name\":\"n2u9v16e4p\",\"__unsaved\":1,\"owner\":\"Administrator\",\"confirmation_email_sent\":1,\"parent\":\"CLS-00011\",\"parentfield\":\"students\",\"parenttype\":\"LMS Batch\",\"idx\":3,\"student_name\":\"Zayn\",\"username\":\"zayn\",\"student\":\"zayn@yopmail.com\",\"creation\":\"2024-05-27 15:02:23.116868\",\"modified\":\"2024-05-27 15:34:55.383226\",\"modified_by\":\"Administrator\"}],\"courses\":[{\"name\":2,\"owner\":\"Administrator\",\"creation\":\"2024-05-27 15:02:23.116868\",\"modified\":\"2024-05-27 15:34:55.383226\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":1,\"course\":\"frappe\",\"title\":\"Frappe\",\"parent\":\"CLS-00011\",\"parentfield\":\"courses\",\"parenttype\":\"LMS Batch\",\"doctype\":\"Batch Course\"}],\"__unsaved\":1}",
		"action": "Save"
	},
	"btn": {
		"jQuery370061454331697587361": {
			"events": {
				"click": [
					{
						"type": "click",
						"origType": "click",
						"guid": 4439,
						"namespace": ""
					}
				]
			}
		}
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.save.savedocs",
	"request_id": null
}

Response Data

{
	"exception": "TypeError: '<' not supported between instances of 'NoneType' and 'str'",
	"exc_type": "TypeError",
	"_exc_source": "lms (app)"
}
@abhi-146 abhi-146 added the bug Something isn't working label May 27, 2024
@abhi-146
Copy link
Author

abhi-146 commented May 27, 2024

File: lms_batch.py

Line: 159

if schedule.date < self.start_date or schedule.date > self.end_date:

No option to select the date. schedule.date is none

Solution:
Date option should be checked by default in timetable child table

@pateljannat pateljannat added the good first issue Good for newcomers label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants