Skip to content
This repository has been archived by the owner on Sep 13, 2021. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nabinhait committed May 20, 2016
2 parents 79966e2 + 6c35143 commit 6dbf9f1
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 15 deletions.
2 changes: 1 addition & 1 deletion schools/__version__.py
@@ -1,2 +1,2 @@
from __future__ import unicode_literals
__version__ = '0.2.0'
__version__ = '0.3.0'
Expand Up @@ -4,7 +4,7 @@ frappe.views.calendar["Course Schedule"] = {
"start": "from_datetime",
"end": "to_datetime",
"id": "name",
"title": "title",
"title": "course",
"allDay": "allDay"
},
gantt: false,
Expand Down
6 changes: 1 addition & 5 deletions schools/api.py
Expand Up @@ -111,7 +111,7 @@ def get_course_schedule_events(start, end, filters=None):
from frappe.desk.calendar import get_event_conditions
conditions = get_event_conditions("Course Schedule", filters)

data = frappe.db.sql("""select name, title,
data = frappe.db.sql("""select name, course,
timestamp(schedule_date, from_time) as from_datetime,
timestamp(schedule_date, to_time) as to_datetime,
room, student_group, 0 as 'allDay'
Expand All @@ -122,8 +122,4 @@ def get_course_schedule_events(start, end, filters=None):
"end": end
}, as_dict=True, update={"allDay": 0})


for d in data:
d.title += " \n for " + d.student_group + " in Room "+ d.room

return data
4 changes: 2 additions & 2 deletions schools/hooks.py
Expand Up @@ -8,7 +8,7 @@
app_icon = "octicon octicon-mortar-board"
app_color = "blue"
app_email = "hello@frappe.io"
app_version = "0.2.0"
app_version = "0.3.0"
app_license = "GNU General Public License v3"

# setup wizard
Expand All @@ -22,7 +22,7 @@

# include js, css files in header of desk.html
# app_include_css = "/assets/schools/css/schools.css"
# app_include_js = "/assets/schools/js/schools.js"
app_include_js = "/assets/js/schools.min.js"

# include js, css files in header of web template
# web_include_css = "/assets/schools/css/schools.css"
Expand Down
29 changes: 27 additions & 2 deletions schools/make_demo.py
Expand Up @@ -5,7 +5,8 @@
from frappe.core.page.data_import_tool.data_import_tool import import_doc
from schools.simulate import simulate
from frappe.utils.make_random import get_random
import time
from datetime import datetime
import time, random

def make():
frappe.flags.mute_emails = True
Expand Down Expand Up @@ -59,17 +60,41 @@ def make_masters():
import_data("Program")

def make_student_applicants():
blood_group = ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]
male_names = []
female_names = []

file_path = get_json_path("Random Student Data")
with open(file_path, "r") as open_file:
random_student_data = json.loads(open_file.read())
count = 1

for d in random_student_data:
if d.get('gender') == "Male":
male_names.append(d.get('first_name').title())

if d.get('gender') == "Female":
female_names.append(d.get('first_name').title())

for d in random_student_data:
student_applicant = frappe.new_doc("Student Applicant")
student_applicant.first_name = d.get('first_name').title()
student_applicant.last_name = d.get('last_name').title()
student_applicant.image = d.get('image')
student_applicant.gender = d.get('gender')
student_applicant.program = get_random("Program")
student_applicant.submit()
student_applicant.blood_group = random.choice(blood_group)
year = random.randint(1990, 1998)
month = random.randint(1, 12)
day = random.randint(1, 28)
student_applicant.date_of_birth = datetime(year, month, day)
student_applicant.mother_name = random.choice(female_names) + " " + d.get('last_name').title()
student_applicant.father_name = random.choice(male_names) + " " + d.get('last_name').title()
if count <5:
student_applicant.save()
else:
student_applicant.submit()
count+=1

def make_student_group():
for d in frappe.db.get_list("Academic Term"):
Expand Down
5 changes: 5 additions & 0 deletions schools/public/build.json
@@ -0,0 +1,5 @@
{
"js/schools.min.js": [
"public/js/conf.js"
]
}
11 changes: 11 additions & 0 deletions schools/public/js/conf.js
@@ -0,0 +1,11 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

frappe.provide('schools');

// add toolbar icon
$(document).bind('toolbar_setup', function() {
frappe.app.name = "Schools";
$('[data-link="docs"]').attr("href", "http://frappe.github.io/schools/")
$('[data-link="issues"]').attr("href", "https://github.com/frappe/schools/issues")
});
7 changes: 4 additions & 3 deletions schools/setup_wizard.py
Expand Up @@ -60,16 +60,17 @@ def create_room(args):
room.save()

def block_modules():
enabled_modules= ["Stock", "Website", "HR", "Learn"]
enabled_modules= ["Stock", "Website", "HR", "Learn", "CRM", "Accounts", "Projects"]
all_erpnext_modules = frappe.get_list("Desktop Icon", fields=["module_name"], filters={'app': 'erpnext'})
for module in all_erpnext_modules:
if module.module_name not in enabled_modules:
set_hidden(module.module_name)

def disable_roles():
enabled_roles_list = [
"Guest", "Administrator", "System Manager", "All", "Academics User",
"HR User", "HR Manager"]
"Guest", "Administrator", "System Manager", "All", "Academics User", "HR User",
"HR Manager", "Website Manager", "Stock User", "Stock Manager", "Newsletter Manager",
"Projects User", "Projects Manager", "Accounts User", "Accounts Manager", "Item Manager"]
for role in frappe.get_list("Role"):
if not role.name in enabled_roles_list:
role_doc = frappe.get_doc("Role", role)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages
from pip.req import parse_requirements

version = '0.2.0'
version = '0.3.0'
requirements = parse_requirements("requirements.txt", session="")

setup(
Expand Down

0 comments on commit 6dbf9f1

Please sign in to comment.