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


Python Store.store_id方法代码示例

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


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

示例1: 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 store_id [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

示例2: 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 store_id [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

示例3: 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 store_id [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

示例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 store_id [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 store_id [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 store_id [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 store_id [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 store_id [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

示例9: test_save_stores_to_change_log

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import store_id [as 别名]
    def test_save_stores_to_change_log(self):
            try:
                # insert a new file into the db
                source_file_id = self._data_repository.insert_source_file("UNITTEST_FILE_PATH", "2012-01-01", 1000)

                # create 5 fake stores
                company_id = insert_test_company()
                address_id = insert_test_address(-40, 40)
                store_id1 = insert_test_store(company_id, address_id)
                store_id2 = insert_test_store(company_id, address_id)
                store_id3 = insert_test_store(company_id, address_id)
                store_id4 = insert_test_store(company_id, address_id)
                store_id5 = insert_test_store(company_id, address_id)

                # create list of 2 deleted stores
                deleted_store_ids = [store_id1, store_id2]

                # create list of 3 changed stores
                store3 = Store()
                store3.store_id = store_id3
                store3.change_type = StoreChangeType.StoreConfirmed
                store3.mismatched_parameters = []
                store4 = Store()
                store4.store_id = store_id4
                store4.change_type = StoreChangeType.StoreUpdated
                store4.mismatched_parameters = ['chicken', 'beef']
                store5 = Store()
                store5.store_id = store_id5
                store5.change_type = StoreChangeType.StoreOpened
                store5.mismatched_parameters = []
                changed_stores = [store3, store4, store5]

                # add the change_longs for the 5 stores (2 deleted, one opened, one confirmed, one updated)
                source_file_id = self._data_repository.save_stores_to_change_log(deleted_store_ids, changed_stores, "2012-01-01", source_file_id)

                # select the change log entries and verify their contents
                change_logs = select_stores_change_log_entries(source_file_id)
                # verify deleted stores
                # store 1
                self.assertEqual(len(change_logs), 5)
                self.assertEqual(change_logs[0].store_id, store_id1)
                self.assertEqual(change_logs[0].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[0].change_type_id, StoreChangeType.StoreClosed)
                self.assertIsNone(change_logs[0].comment)
                self.assertEqual(change_logs[0].source_file_id, source_file_id)
                # store 2
                self.assertEqual(change_logs[1].store_id, store_id2)
                self.assertEqual(change_logs[1].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[1].change_type_id, StoreChangeType.StoreClosed)
                self.assertIsNone(change_logs[1].comment)
                self.assertEqual(change_logs[1].source_file_id, source_file_id)
                # store 3
                self.assertEqual(change_logs[2].store_id, store_id3)
                self.assertEqual(change_logs[2].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[2].change_type_id, StoreChangeType.StoreConfirmed)
                self.assertEqual(change_logs[2].comment, '[]')
                self.assertEqual(change_logs[2].source_file_id, source_file_id)
                # store 4
                self.assertEqual(change_logs[3].store_id, store_id4)
                self.assertEqual(change_logs[3].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[3].change_type_id, StoreChangeType.StoreUpdated)
                self.assertEqual(change_logs[3].comment, "['chicken', 'beef']")
                self.assertEqual(change_logs[3].source_file_id, source_file_id)
                # store 5
                self.assertEqual(change_logs[4].store_id, store_id5)
                self.assertEqual(change_logs[4].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[4].change_type_id, StoreChangeType.StoreOpened)
                self.assertEqual(change_logs[4].comment, "[]")
                self.assertEqual(change_logs[4].source_file_id, source_file_id)
            except:
                raise
            finally:
                delete_store_change_logs_by_source_file_id(source_file_id)
                delete_test_source_file(source_file_id)
                delete_test_store(store_id1)
                delete_test_store(store_id2)
                delete_test_store(store_id3)
                delete_test_store(store_id4)
                delete_test_store(store_id5)
                delete_test_address(address_id)
                delete_test_company(company_id)
开发者ID:erezrubinstein,项目名称:aa,代码行数:83,代码来源:test_change_log_data_access.py

示例10: select_trade_areas

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import store_id [as 别名]
 def select_trade_areas(self):
     store = Store()
     store.store_id = self.away_store_id
     return store.select_trade_areas()
开发者ID:erezrubinstein,项目名称:aa,代码行数:6,代码来源:store_competition_instance.py


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