Subversion Repositories SmartDukaan

Rev

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

Rev 15809 Rev 15810
Line 124... Line 124...
124
        db.rollback()
124
        db.rollback()
125
        
125
        
126
    cursor.execute(userGroupSegmentationQuery)
126
    cursor.execute(userGroupSegmentationQuery)
127
    allUserGroups = cursor.fetchall()
127
    allUserGroups = cursor.fetchall()
128
    for userGroup in allUserGroups:
128
    for userGroup in allUserGroups:
-
 
129
        min_price = userGroup[2]
-
 
130
        if min_price is None:
-
 
131
            min_price = 0.0
-
 
132
        max_price = userGroup[3]
-
 
133
        if max_price is None:
-
 
134
            max_price = 0.0
-
 
135
        category_id = userGroup[5]
-
 
136
        if category_id is None:
-
 
137
            category_id= 0
-
 
138
            
129
        sql = "insert into pushnotificationusergroups (brand, userids, min_price, max_price, pricerange, category_id) values('%s', '%s', %f, %f, '%s', %d)"%(userGroup[0], userGroup[1], userGroup[2], userGroup[3], userGroup[4], userGroup[5])
139
        sql = "insert into pushnotificationusergroups (brand, userids, min_price, max_price, pricerange, category_id) values('%s', '%s', %f, %f, '%s', %d)"%(userGroup[0], userGroup[1], min_price, max_price, userGroup[4], category_id)
130
        print sql
140
        print sql
131
        try:
141
        try:
132
            dtrdb = MySQLdb.connect('localhost',"root","shop2020","dtr" )
142
            dtrdb = MySQLdb.connect('localhost',"root","shop2020","dtr" )
133
            cursor = dtrdb.cursor()
143
            cursor = dtrdb.cursor()
134
            cursor.execute(sql)
144
            cursor.execute(sql)