fix package layout
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 6 Feb 2013 15:27:59 +0000 (16:27 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 6 Feb 2013 15:27:59 +0000 (16:27 +0100)
catalogue/management/commands/repackage.py

index e6de171..47930ec 100755 (executable)
@@ -23,19 +23,29 @@ class Command(BaseCommand):
             
             for si, section in enumerate(Section.objects.all()):
                 li = 1
             
             for si, section in enumerate(Section.objects.all()):
                 li = 1
+                li_adv = 1
                 for lesson in section.lesson_set.all():
                     if lesson.type == 'course':
                 for lesson in section.lesson_set.all():
                     if lesson.type == 'course':
-                        prefix = "%d_%s/%02d_%s/" % (
-                                si, section.slug,
-                                li, lesson.slug,
+                        if lesson.level.slug == "liceum":
+                            ind = li_adv
+                            li_adv += 1
+                            postfix = " (zaawansowane)"
+                        else:
+                            ind = li
+                            li += 1
+                            postfix = ""
+                        prefix = "%d_%s%s/%02d_%s/" % (
+                                si, section.slug, postfix,
+                                ind,
+                                lesson.slug,
                             )
                         li += 1
                     elif lesson.type == 'synthetic':
                             )
                         li += 1
                     elif lesson.type == 'synthetic':
-                        prefix = "%d_%s/synteza_%s/" % (
-                                si, section.slug, lesson.slug)
+                        prefix = "%d_%s%s/synteza_%s/" % (
+                                si, section.slug, postfix, lesson.slug)
                     else:
                     else:
-                        prefix = "%d_%s/%s/" % (
-                                si, section.slug, lesson.slug)
+                        prefix = "%d_%s%s/%s/" % (
+                                si, section.slug, postfix, lesson.slug)
                     lesson.add_to_zip(zipf, student, prefix)
             zipf.close()
 
                     lesson.add_to_zip(zipf, student, prefix)
             zipf.close()