You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
787 B
29 lines
787 B
# coding=utf-8
|
|
import os
|
|
import django
|
|
import sys
|
|
|
|
sys.path.append("/var/www/projects/lms/")
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.settings")
|
|
django.setup()
|
|
from finance.models import Price
|
|
from courses.models import CourseMap
|
|
|
|
for price in Price.objects.filter(included=None):
|
|
if not price.included.exists():
|
|
inc_type = []
|
|
|
|
if price.m_type == 'B':
|
|
inc_type = ['B']
|
|
elif price.m_type == 'E':
|
|
inc_type = ['B', 'E']
|
|
elif price.m_type == 'P':
|
|
inc_type = ['B', 'E', 'P']
|
|
for m in CourseMap.objects.filter(course=price.course):
|
|
if m.get_obj().theme.price_type in inc_type:
|
|
price.included.add(m)
|
|
l=0
|
|
for price in Price.objects.filter(included=None):
|
|
l += 1
|
|
|
|
print l
|
|
|