Beispiel #1
0
 def setUp(self):
     self._pm = MongoDBPersistenceManager({
         "db": {
             "url": "localhost",
             "port": 27017,
             "db_name": "campus_unimi_test"
         }
     })
     ODMModel.set_pm(self._pm)
     self._pm.clean_collection("building")
Beispiel #2
0
 def test_clean(self):
     pm = MongoDBPersistenceManager({
         "db": {
             "url": "localhost",
             "port": 27017,
             "db_name": "campus_unimi_test"
         }
     })
     ODMModel.set_pm(pm)
     dic = {"_id": "2323", "pippo": "pluto"}
     odm = ODMModel(dic)
     odm.save()
     self.assertEqual(
         ODMModel._pm.get_collection("odmmodel").find_one({"_id": "2323"}),
         dic)
     odm.clean()
     self.assertEqual(
         ODMModel._pm.get_collection("odmmodel").find_one({"_id": "2323"}),
         None)
Beispiel #3
0
from utils.config_manager import ConfigManager
from persistence.db import MongoDBPersistenceManager
from model.odm      import ODMModel
from model          import Building
from utils.logger   import Logger
from analysis       import DXFAnalysis
from analysis       import FloorMergeAnalysis
from analysis       import BuildingIdAnalysis

persistence = MongoDBPersistenceManager(ConfigManager("config/general.json"))
ODMModel.set_pm( persistence )


def data_and_percent(value, total, num_padding = 3,):
   if(total > 0):
      return ("{:0>"+str(num_padding)+"} ({:>0.1f}%)").format(value, value/total*100.0)
   else:
      return ("{:0>"+str(num_padding)+"} ").format(value)

class GeneralReport:

   merge_tuples = [
            ("edilizia", "dxf"),
            ("edilizia", "easyroom"),
            ("easyroom", "dxf"),
            ("easyroom", "edilizia")
         ]

   @classmethod
   def report_building(klass, building):
      BuildingIdAnalysis.analyse_building_id(building)
Beispiel #4
0
   def setUp(self):
      pm = MongoDBPersistenceManager({
         "db": {
               "url"     : "localhost",
               "port"    : 27017,
               "db_name" : "campus_unimi_test"
            }
      })

      ODMModel.set_pm(pm)

      self.edil_rooms = [
         {
            'room_name' : 'Aula Seminari',
            'cat_name'  : 'Aula',
            'r_id'      : 'T-065',
            'b_id'      : '21030',
            'capacity'  : '52',
            'l_floor'   : 'T'
         },
         {
            'room_name' : 'Aula Pippo',
            'cat_name'  : 'Aula',
            'r_id'      : 'T066',
            'b_id'      : '21030',
            'capacity'  : '52',
            'l_floor'   : 'T'
         },
         {
            'room_name' : 'Aula Pippo Sdentato',
            'cat_name'  : 'Aula',
            'r_id'      : '1066',
            'b_id'      : '21030',
            'capacity'  : '52',
            'l_floor'   : '1'
         }
      ]

      self.easy_rooms = [
         {
            'room_name' : 'Aula Seminari',
            'cat_name'  : 'Aula',
            'r_id'      : '21030#T-065',
            'b_id'      : '21030',
            'capacity'  : '52',
            'l_floor'   : '0'
         },
         {
            'room_name' : 'Aula Pippo',
            'cat_name'  : 'Aula',
            'r_id'      : '21030#T066',
            'b_id'      : '21030',
            'capacity'  : '52',
            'l_floor'   : '0'
         },
         {
            'room_name' : 'Aula Pippo Sdentato',
            'cat_name'  : 'Aula',
            'r_id'      : '21030#1066',
            'b_id'      : '21030',
            'capacity'  : '52',
            'l_floor'   : '10'
         }
      ]

      pm.clean_collection("building")
      self.edil_up      = EdiliziaDataUpdater()
      self.easy_up      = EasyroomDataUpdater()
      Building.__str__  = lambda x: ""