当前位置: 首页>>代码示例>>Python>>正文


Python Store._opened_date方法代码示例

本文整理汇总了Python中geoprocessing.business_logic.business_objects.store.Store._opened_date方法的典型用法代码示例。如果您正苦于以下问题:Python Store._opened_date方法的具体用法?Python Store._opened_date怎么用?Python Store._opened_date使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在geoprocessing.business_logic.business_objects.store.Store的用法示例。


在下文中一共展示了Store._opened_date方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_matched_open_store_from_db

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _opened_date [as 别名]
def get_matched_open_store_from_db(address_id, company_id, phone, store_format):

    statement = '''
        select
            s.store_id,
            s.company_id,
            s.address_id,
            s.phone_number,
            s.store_format,
            s.company_generated_store_number,
            s.note,
            s.opened_date,
            s.assumed_opened_date
        from stores s
        where s.address_id = %d and s.company_id = %d and s.phone_number %s and s.store_format %s
            and s.closed_date is null and s.assumed_closed_date is null''' % (address_id, company_id, select_clean_up_string(phone), select_clean_up_string(store_format))

    db_store_params = sql_execute(statement)

    if len(db_store_params) > 0:
        db_store = Store()
        db_store.store_id = db_store_params[0].store_id
        db_store.company_id = db_store_params[0].company_id
        db_store.address_id = db_store_params[0].address_id
        db_store.phone_number = db_store_params[0].phone_number
        db_store._opened_date = db_store_params[0].opened_date
        db_store._assumed_opened_date = db_store_params[0].assumed_opened_date
        db_store.store_format = db_store_params[0].store_format
        db_store.company_generated_store_number = db_store_params[0].company_generated_store_number
        db_store.note = db_store_params[0].note
        return db_store
    else:
        return None
开发者ID:erezrubinstein,项目名称:aa,代码行数:35,代码来源:store_handler.py

示例2: test_synchronize_competitive_stores__upserts_properly

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _opened_date [as 别名]
    def test_synchronize_competitive_stores__upserts_properly(self):
        """
        This test verifies that calling synchronize_competitive_stores_in_db will insert/update any competitive_stores are new or existing
        """
        # create a mock home store
        home_store = Store()
        home_store.store_id = 1
        home_store.company_id = 1
        home_store._opened_date = "2012-01-01"
        home_store._assumed_opened_date = "2012-01-01"

        # create three mock stores
        existing_competitor = StoreCompetitionInstance.basic_init(2, 2, -1, -1)
        new_competitor = StoreCompetitionInstance.basic_init(4, 4, -1, -1)

        # add the mock stores as existing competitive stores (by id)
        # !!!! VERY IMPORTANT TO DO A DEEP COPY.  This makes it work like a database (i.e. different objects) when doing set comparisons
        self._data_repository.competitive_stores[1] = [copy.deepcopy(existing_competitor)]

        # create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
        away_stores = [existing_competitor, new_competitor]
        competitive_stores = CompetitiveStoreHelper(home_store, away_stores, 10, self._data_repository)

        # call synchronize and verify that the right store was closed
        competitive_stores.synchronize_competitive_stores_in_db()
        self.assertEqual(self._data_repository.batch_upserted_competitive_stores, [
            competitive_stores._create_batch_competition_structure(existing_competitor, datetime(2012, 01, 01), None, True, home_store.store_id),
            competitive_stores._create_batch_competition_structure(new_competitor, datetime(2012, 01, 01), None, True, home_store.store_id)
        ])
        self.assertEqual(self._data_repository.batch_upserted_trade_area_id, 10)
开发者ID:erezrubinstein,项目名称:aa,代码行数:32,代码来源:test_competitive_store_helper.py

示例3: get_matched_open_store_from_db_by_core_store_id

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _opened_date [as 别名]
def get_matched_open_store_from_db_by_core_store_id(core_store_id):

    statement = '''
        select
            s.store_id,
            s.company_id,
            s.address_id,
            s.phone_number,
            s.store_format,
            s.company_generated_store_number,
            s.note,
            s.opened_date,
            s.assumed_opened_date
        from stores s
        where core_store_id = '%s' and s.closed_date is null and s.assumed_closed_date is null''' % core_store_id

    db_store_params = sql_execute(statement)
    if len(db_store_params) > 0:
        db_store = Store()
        db_store.store_id = db_store_params[0].store_id
        db_store.company_id = db_store_params[0].company_id
        db_store.address_id = db_store_params[0].address_id
        db_store.phone_number = db_store_params[0].phone_number
        db_store._opened_date = db_store_params[0].opened_date
        db_store._assumed_opened_date = db_store_params[0].assumed_opened_date
        db_store.store_format = db_store_params[0].store_format
        db_store.company_generated_store_number = db_store_params[0].company_generated_store_number
        db_store.note = db_store_params[0].note
        return db_store
    else:
        return None
开发者ID:erezrubinstein,项目名称:aa,代码行数:33,代码来源:store_handler.py

示例4: test_synchronize_competitive_stores__competitive_company_instance_opens_after_competitive_stores

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _opened_date [as 别名]
    def test_synchronize_competitive_stores__competitive_company_instance_opens_after_competitive_stores(self):
        """
        This verifies that it is inserted if stores' open/closed dates are still open but competitive_companies start after
        """
        # create a mock home store
        home_store = Store()
        home_store.store_id = 1
        home_store.company_id = 1
        home_store._assumed_opened_date = "1900-01-01"
        home_store._opened_date = "1900-01-01"
        home_store._assumed_closed_date = None
        home_store._closed_date = None

        # create three mock stores
        new_competitor = StoreCompetitionInstance.standard_init(4, 4, -1, -1, None, None, "1900-01-01", None, "1900-01-01", None, "2011-01-01", None)

        # create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
        away_stores = [new_competitor]
        competitive_stores = CompetitiveStoreHelper(home_store, away_stores, 10, self._data_repository)

        # call synchronize and verify that the right store was inserted with the right dates
        competitive_stores.synchronize_competitive_stores_in_db()
        self.assertEqual(self._data_repository.batch_upserted_competitive_stores, [
            competitive_stores._create_batch_competition_structure(new_competitor, datetime(2011, 1, 1), None, True, home_store.store_id)
        ])
        self.assertEqual(self._data_repository.batch_upserted_trade_area_id, 10)
开发者ID:erezrubinstein,项目名称:aa,代码行数:28,代码来源:test_competitive_store_helper.py

示例5: Store

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _opened_date [as 别名]
    def test_synchronize_competitive_stores__competitive_company_instance_opens_after_competitive_stores_close(self):
        """
        This verifies that NOTHING is inserted if stores' close before companies become competitive
        """
        # create a mock home store
        home_store = Store()
        home_store.store_id = 1
        home_store.company_id = 1
        home_store._assumed_opened_date = "2009-01-01"
        home_store._opened_date = "2009-01-01"
        home_store._assumed_closed_date = "2010-12-01"
        home_store._closed_date = "2010-12-01"

        # create three mock stores
        new_competitor = StoreCompetitionInstance.standard_init(4, 4, -1, -1, None, None, "2009-01-01", "2010-12-01", "2009-01-01", "2010-12-01", "2011-01-01", "2011-12-01")

        # create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
        away_stores = [new_competitor]
        competitive_stores = CompetitiveStoreHelper(home_store, away_stores, 10, self._data_repository)

        # call synchronize and verify that the right store was inserted with the right dates
        competitive_stores.synchronize_competitive_stores_in_db()
        self.assertEqual(len(self._data_repository.upserted_away_stores), 0)
        self.assertEqual(self._data_repository.batch_upserted_competitive_stores, [])
        self.assertEqual(self._data_repository.batch_upserted_trade_area_id, 10)
开发者ID:erezrubinstein,项目名称:aa,代码行数:27,代码来源:test_competitive_store_helper.py

示例6: test_synchronize_competitive_stores__stores_overlap_in_dates__home_store_dates_within_away_store

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _opened_date [as 别名]
    def test_synchronize_competitive_stores__stores_overlap_in_dates__home_store_dates_within_away_store(self):
        """
        This verifies that it is inserted if stores' open/closed dates do overlap with home store contained between the away store dates
        """
        # create a mock home store
        home_store = Store()
        home_store.store_id = 1
        home_store.company_id = 1
        home_store._assumed_opened_date = "2011-01-01"
        home_store._opened_date = "2011-01-01"
        home_store._assumed_closed_date = "2011-12-01"
        home_store._closed_date = "2011-12-01"

        # create three mock stores
        new_competitor = StoreCompetitionInstance.standard_init(4, 4, -1, -1, None, None, "2010-01-01", "2012-12-01", "2010-01-01", "2012-12-01", None, None)

        # create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
        away_stores = [new_competitor]
        competitive_stores = CompetitiveStoreHelper(home_store, away_stores, 10, self._data_repository)

        # call synchronize and verify that the right store was inserted with the right dates
        competitive_stores.synchronize_competitive_stores_in_db()
        self.assertEqual(self._data_repository.batch_upserted_competitive_stores, [
            competitive_stores._create_batch_competition_structure(new_competitor, datetime(2011, 01, 01), datetime(2011, 12, 01), True, home_store.store_id)
        ])
        self.assertEqual(self._data_repository.batch_upserted_trade_area_id, 10)
开发者ID:erezrubinstein,项目名称:aa,代码行数:28,代码来源:test_competitive_store_helper.py

示例7: get_open_store_ids_and_open_dates_for_company

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _opened_date [as 别名]
def get_open_store_ids_and_open_dates_for_company(company_info):
    statement = '''
                    SELECT
                        store_id,
                        opened_date,
                        assumed_opened_date
                    FROM stores
                    WHERE company_id = ? AND closed_date is null AND assumed_closed_date is null AND assumed_opened_date < ?'''
    row = sql_execute_with_parameters([company_info.company_id, company_info.as_of_date], statement)
    stores = []
    for store_triple in row:
        store = Store()
        store.store_id = store_triple.store_id
        store._opened_date = store_triple.opened_date
        store._assumed_opened_date = store_triple.assumed_opened_date
        stores.append(store)
    return stores
开发者ID:erezrubinstein,项目名称:aa,代码行数:19,代码来源:store_handler.py

示例8: test_synchronize_competitive_stores__upsert__away_store_closes_before_home_store_opens

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _opened_date [as 别名]
    def test_synchronize_competitive_stores__upsert__away_store_closes_before_home_store_opens(self):
        """
        This verifies that nothing is inserted if stores' open/closed dates do not overlap
        """
        # create a mock home store
        home_store = Store()
        home_store.store_id = 1
        home_store.company_id = 1
        home_store._assumed_opened_date = "2012-01-01"
        home_store._opened_date = "2012-01-01"

        # create three mock stores
        new_competitor = StoreCompetitionInstance.standard_init(4, 4, -1, -1, None, None, "1900-01-01", "2011-01-01", "1900-01-01", "2011-01-01", None, None)

        # create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
        away_stores = [new_competitor]
        competitive_stores = CompetitiveStoreHelper(home_store, away_stores, 10, self._data_repository)

        # call synchronize and verify that nothing was inserted
        competitive_stores.synchronize_competitive_stores_in_db()
        self.assertEqual(len(self._data_repository.upserted_away_stores), 0)
        self.assertEqual(self._data_repository.batch_upserted_competitive_stores, [])
        self.assertEqual(self._data_repository.batch_upserted_trade_area_id, 10)
开发者ID:erezrubinstein,项目名称:aa,代码行数:25,代码来源:test_competitive_store_helper.py


注:本文中的geoprocessing.business_logic.business_objects.store.Store._opened_date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。