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

Merge the student group and student batch #8663

Merged
merged 20 commits into from
May 9, 2017
Merged

Conversation

manassolanki
Copy link
Contributor

  • Change the student group doctype
  • Delete the student batch doctype
  • Patch to map the student batch data on the student group
  • Changes in the linked doctype
  • Cleanup for deprecated doctype

Copy link
Member

@nabinhait nabinhait left a comment

Choose a reason for hiding this comment

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

Screenshot please

for student_batch in student_batches:
student_batch.update({"doctype":"Student Group", "group_based_on": "Batch"})
doc = frappe.get_doc(student_batch)
doc.save()
Copy link
Member

Choose a reason for hiding this comment

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

Why saving doc here? you can save after adding child records.


# for converting student batch into student group
frappe.reload_doctype("Student Group")
student_batches = frappe.db.sql('''select name as student_group_name, student_batch_name as batch, program, academic_year, academic_term
Copy link
Member

Choose a reason for hiding this comment

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

use multilines after 80 chars


# delete the student batch and child-table
frappe.delete_doc("DocType", "Student Batch", force=1)
# frappe.db.sql("drop table if exists `tabStudent Batch`")
Copy link
Member

Choose a reason for hiding this comment

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

remove commented lines


def validate_course(self):
if self.student_group:
if self.student_group and frappe.db.get_value("Student Group", self.student_group, "group_based_on") == "Course":
Copy link
Member

Choose a reason for hiding this comment

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

Why 2 queries? It should be like this:

if self.student_group:
    group_based_on, course = frappe.db.get_value("Student Group", self.student_group, ["group_based_on", "course"])
    if group_based_on == "Course":
        self.course = course

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't know this method

if self.student_group:

if self.student_group and frappe.db.get_value("Student Group", self.student_group, "group_based_on") == "Course":
Copy link
Member

Choose a reason for hiding this comment

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

same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants