Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Bundler.py
blob: f8b5286c6ac4520af37c8b3ae7f8b452512e05a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from Models import *

class Bundler():
    
    def bundle_rubric(self,rubric):
        
        rubric_bundle = "Rubric|" + str(rubric.rubric_id)+"|"+rubric.title+"|"+\
                        rubric.author+"|"+rubric.description+"|"+\
                        str(rubric.is_predefined) +"|"+rubric.xo_name +"|"+\
                        rubric.rubric_sha+"|"+str(rubric.enable_points)
                        
        return rubric_bundle
    
    def bundle_category(self, categories):
        
        categorylist = []
        for category in categories:
            bundle = "Category|" + str(category.category_id)+"|"+category.name+"|"+\
                str(category.rubric_id) +"|"+\
                category.category_sha+"|"+str(category.percentage)
            categorylist.append(bundle)
        
        return categorylist
    
    def bundle_level(self, levels):
        
        levelist = []
        for level in levels:
            bundle = "Level|" + str(level.level_id) +"|"+ level.name+"|"+level.description+"|"+\
                str(level.category_id)+"|"+str(level.rubric_id)+"|"+\
                level.level_sha+"|"+str(level.points)
            levelist.append(bundle)
                
        return levelist