trex-model 1.6.9__tar.gz → 1.6.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of trex-model might be problematic. Click here for more details.
- {trex_model-1.6.9 → trex_model-1.6.10}/PKG-INFO +1 -1
- {trex_model-1.6.9 → trex_model-1.6.10}/setup.py +1 -1
- {trex_model-1.6.9 → trex_model-1.6.10}/trex_model.egg-info/PKG-INFO +1 -1
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/customer_model_helpers.py +26 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/customer_models.py +6 -1
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/merchant_models.py +2 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/ndb_models.py +9 -3
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/rating_models.py +28 -2
- {trex_model-1.6.9 → trex_model-1.6.10}/LICENSE +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/MANIFEST.in +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/README.md +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/setup.cfg +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trex_model.egg-info/SOURCES.txt +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trex_model.egg-info/dependency_links.txt +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trex_model.egg-info/requires.txt +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trex_model.egg-info/top_level.txt +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/__init__.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/conf.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/__init__.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/__init__.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/admin_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/analytic_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/app_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/coporate_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/fb_subsriber_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/helper/__init__.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/helper/reward_model_helpers.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/helper/reward_transaction_helper.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/helper/sales_transaction_helpers.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/import_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/inventory_model.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/loyalty_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/lucky_draw_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/marketing_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/membership_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/merchant_promotion_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/message_model_helper.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/message_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/model_decorators.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/partnership_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/pos_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/prepaid_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/product_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/program_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/recruit_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/redeem_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/redemption_catalogue_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/referral_program_model.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/reward_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/spending_base_program_model.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/system_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/task_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/test_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/transaction_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/user_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/voucher_models.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/merchant_helpers.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/model_decorator.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/prepaid_helpers.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/pos_conf.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/program_conf.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/utils/__init__.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/utils/gcloud/__init__.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/utils/gcloud/datastore_util.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/utils/model/__init__.py +0 -0
- {trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/utils/model/model_util.py +0 -0
|
@@ -399,6 +399,32 @@ def update_customer_entiteld_voucher_summary_after_removed_voucher(customer_enti
|
|
|
399
399
|
customer_entitled_voucher_summary[merchant_voucher_key]['amount'] = len(new_redeem_info_list)
|
|
400
400
|
|
|
401
401
|
return customer_entitled_voucher_summary
|
|
402
|
+
|
|
403
|
+
def update_customer_entiteld_voucher_summary_after_removed_voucher_by_redeem_code(customer_entitled_voucher_summary, redeem_code):
|
|
404
|
+
'''
|
|
405
|
+
removed entitled voucher from customer entitled voucher summary
|
|
406
|
+
'''
|
|
407
|
+
logger.debug('redeem_code=%s', redeem_code)
|
|
408
|
+
|
|
409
|
+
new_customer_entitled_voucher_summary = {}
|
|
410
|
+
|
|
411
|
+
if customer_entitled_voucher_summary:
|
|
412
|
+
|
|
413
|
+
for merchant_voucher_key, voucher_summary in customer_entitled_voucher_summary.items():
|
|
414
|
+
new_redeem_info_list = []
|
|
415
|
+
redeem_info_list = voucher_summary.get('redeem_info_list')
|
|
416
|
+
for redeem_info in redeem_info_list:
|
|
417
|
+
if redeem_info.get('redeem_code')!=redeem_code:
|
|
418
|
+
new_redeem_info_list.append(redeem_info)
|
|
419
|
+
|
|
420
|
+
new_customer_entitled_voucher_summary[merchant_voucher_key] = {}
|
|
421
|
+
new_customer_entitled_voucher_summary[merchant_voucher_key]['redeem_info_list'] = new_redeem_info_list
|
|
422
|
+
new_customer_entitled_voucher_summary[merchant_voucher_key]['count'] = len(new_redeem_info_list)
|
|
423
|
+
new_customer_entitled_voucher_summary[merchant_voucher_key]['amount'] = len(new_redeem_info_list)
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
return new_customer_entitled_voucher_summary
|
|
402
428
|
|
|
403
429
|
|
|
404
430
|
def update_customer_entiteld_voucher_summary_after_reverted_voucher(entitled_voucher_summary, reverted_customer_voucher):
|
|
@@ -19,7 +19,8 @@ from datetime import datetime, timedelta
|
|
|
19
19
|
from trexmodel.models.datastore.membership_models import MerchantTierMembership,\
|
|
20
20
|
MerchantMembership
|
|
21
21
|
from trexmodel.models.datastore.customer_model_helpers import update_customer_entiteld_voucher_summary_after_removed_voucher,\
|
|
22
|
-
update_customer_entiteld_voucher_summary_with_customer_new_voucher
|
|
22
|
+
update_customer_entiteld_voucher_summary_with_customer_new_voucher,\
|
|
23
|
+
update_customer_entiteld_voucher_summary_after_removed_voucher_by_redeem_code
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
logger = logging.getLogger('model')
|
|
@@ -758,6 +759,10 @@ class Customer(BaseNModel, DictModel, FullTextSearchable):
|
|
|
758
759
|
update_customer_entiteld_voucher_summary_after_removed_voucher(entitled_voucher_summary, removed_voucher)
|
|
759
760
|
self.put()
|
|
760
761
|
|
|
762
|
+
def update_after_removed_voucher_by_redeem_code(self, redeem_code):
|
|
763
|
+
self.entitled_voucher_summary = update_customer_entiteld_voucher_summary_after_removed_voucher_by_redeem_code(self.entitled_voucher_summary, redeem_code)
|
|
764
|
+
self.put()
|
|
765
|
+
|
|
761
766
|
def update_after_added_voucher(self, added_voucher):
|
|
762
767
|
entitled_voucher_summary = self.entitled_voucher_summary
|
|
763
768
|
update_customer_entiteld_voucher_summary_with_customer_new_voucher(entitled_voucher_summary, added_voucher)
|
|
@@ -139,8 +139,13 @@ class DictObject(object):
|
|
|
139
139
|
def properties(self):
|
|
140
140
|
return self.__dict__
|
|
141
141
|
|
|
142
|
-
def to_dict(self, full=True, show_key=True, dict_properties=None,
|
|
143
|
-
|
|
142
|
+
def to_dict(self, full=True, show_key=True, dict_properties=None,
|
|
143
|
+
excluded_dict_properties=None,
|
|
144
|
+
#gmt=lib_conf.DEFAULT_GMT,
|
|
145
|
+
gmt=0,
|
|
146
|
+
datetime_format=lib_conf.DEFAULT_DATETIME_FORMAT,
|
|
147
|
+
date_format=lib_conf.DEFAULT_DATE_FORMAT,
|
|
148
|
+
time_format=lib_conf.DEFAULT_TIME_FORMAT,
|
|
144
149
|
deep_level=99,
|
|
145
150
|
):
|
|
146
151
|
logger.info('calling DictObject.to_dict')
|
|
@@ -183,7 +188,8 @@ class DictModel(ndb.Model):
|
|
|
183
188
|
def __str__(self):
|
|
184
189
|
return '%s' % self.to_dict(deep_level=1)
|
|
185
190
|
|
|
186
|
-
def to_dict(self, full=False, show_key=True, dict_properties=None, excluded_dict_properties=None,
|
|
191
|
+
def to_dict(self, full=False, show_key=True, dict_properties=None, excluded_dict_properties=None,
|
|
192
|
+
gmt=0,
|
|
187
193
|
datetime_format=lib_conf.DEFAULT_DATETIME_FORMAT,
|
|
188
194
|
date_format=lib_conf.DEFAULT_DATE_FORMAT,time_format=lib_conf.DEFAULT_TIME_FORMAT,
|
|
189
195
|
deep_level=99,
|
|
@@ -12,6 +12,7 @@ from datetime import datetime, timedelta
|
|
|
12
12
|
import logging
|
|
13
13
|
from trexmodel.models.datastore.transaction_models import CustomerTransaction
|
|
14
14
|
from trexmodel.models.datastore.model_decorators import model_transactional
|
|
15
|
+
from trexlib.utils.common.date_util import convert_date_to_datetime
|
|
15
16
|
|
|
16
17
|
#logger = logging.getLogger('model')
|
|
17
18
|
logger = logging.getLogger('target_debug')
|
|
@@ -34,13 +35,34 @@ class TransactionRating(RatingBase):
|
|
|
34
35
|
|
|
35
36
|
created_datetime = ndb.DateTimeProperty(required=True, auto_now_add=True)
|
|
36
37
|
|
|
37
|
-
dict_properties = ['transaction_id','rating_result', 'remarks', 'industry', 'score',
|
|
38
|
+
dict_properties = ['transaction_id','rating_result', 'remarks', 'industry', 'score', 'created_datetime',
|
|
38
39
|
]
|
|
39
40
|
|
|
40
41
|
@property
|
|
41
42
|
def merchant_acct_entity(self):
|
|
42
43
|
return self.merchant_acct.get()
|
|
43
44
|
|
|
45
|
+
@property
|
|
46
|
+
def user_acct_key(self):
|
|
47
|
+
return self.user_acct.urlsafe().decode('utf-8')
|
|
48
|
+
|
|
49
|
+
@staticmethod
|
|
50
|
+
def list_transaction_by_date(enquiry_date, outlet=None, offset=0, limit=conf.PAGINATION_SIZE, return_with_cursor=False, start_cursor=None):
|
|
51
|
+
start_datetime = convert_date_to_datetime(enquiry_date)
|
|
52
|
+
end_datetime = start_datetime + timedelta(days=1)
|
|
53
|
+
query = TransactionRating.query(
|
|
54
|
+
ndb.AND(
|
|
55
|
+
TransactionRating.outlet==outlet.create_ndb_key(),
|
|
56
|
+
TransactionRating.created_datetime>=start_datetime,
|
|
57
|
+
TransactionRating.created_datetime<end_datetime,
|
|
58
|
+
))
|
|
59
|
+
if return_with_cursor:
|
|
60
|
+
(result, next_cursor) = TransactionRating.list_all_with_condition_query(query, order_by=TransactionRating.created_datetime, start_cursor=start_cursor, return_with_cursor=True, limit=limit)
|
|
61
|
+
|
|
62
|
+
return (result, next_cursor)
|
|
63
|
+
else:
|
|
64
|
+
return query.order(TransactionRating.created_datetime).fetch(offset=offset, limit=limit)
|
|
65
|
+
|
|
44
66
|
@staticmethod
|
|
45
67
|
@model_transactional(desc="update rating changes")
|
|
46
68
|
def create(user_acct, transaction_id, rating_result={},
|
|
@@ -321,7 +343,11 @@ class OutletRatingResult(RatingResult):
|
|
|
321
343
|
outlet = ndb.KeyProperty(name="outlet", kind=Outlet)
|
|
322
344
|
|
|
323
345
|
|
|
324
|
-
dict_properties = ['total_rating_count', 'rating_result', 'previous_rating_result', 'modified_datetime',]
|
|
346
|
+
dict_properties = ['total_rating_count', 'rating_result', 'previous_rating_result', 'modified_datetime', 'outlet_key']
|
|
347
|
+
|
|
348
|
+
@property
|
|
349
|
+
def outlet_key(self):
|
|
350
|
+
return self.outlet.urlsafe().decode('utf-8')
|
|
325
351
|
|
|
326
352
|
@staticmethod
|
|
327
353
|
def get_by_outlet(outlet):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/helper/reward_model_helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/merchant_promotion_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/redemption_catalogue_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.9 → trex_model-1.6.10}/trexmodel/models/datastore/spending_base_program_model.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|