Subversion Repositories SmartDukaan

Rev

Rev 3376 | Rev 3554 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3376 Rev 3386
Line 68... Line 68...
68
    promotion_tracker.transaction_id = transaction_id
68
    promotion_tracker.transaction_id = transaction_id
69
    promotion_tracker.user_id = user_id
69
    promotion_tracker.user_id = user_id
70
    promotion_tracker.applied_on = datetime.datetime.now()
70
    promotion_tracker.applied_on = datetime.datetime.now()
71
    session.commit()
71
    session.commit()
72
 
72
 
-
 
73
def get_active_coupons():
-
 
74
    return Coupon.query.all()
-
 
75
 
-
 
76
def get_successful_payment_count_for_coupon(coupon_code):
-
 
77
    return PromotionTracker.query.filter_by(coupon_code = coupon_code).count()
-
 
78
 
-
 
79
def get_rule_doc_string(rule_name):
-
 
80
    imported_coupon_module = __import__("shop2020.model.v1.user.promotionrules", globals(), locals(), [rule_name])
-
 
81
    rule = eval("imported_coupon_module." + rule_name)
-
 
82
    print rule.__doc__
-
 
83
    return rule.__doc__
-
 
84
            
73
def close_session():
85
def close_session():
74
    if session.is_active:
86
    if session.is_active:
75
        session.close()
87
        session.close()
76
        
88
        
77
def is_alive():
89
def is_alive():