Tuesday, May 8, 2012

URL Enter work flow


When user insert a URL to keep track:
 - parse the url
 - insert/update in products_item (do select on product_id and store)
   - if exists already in products_item, update the information.
   - else insert into products_item
 - insert into products_tracklist

 pseudocode
 * parse the information
 * select id, price from products_item where product_id  = blah and store = blah;
 * if (price == null)
 *    insert into products_item values (info);
 *      insert into price_history the new price
 * else if (price != new_price)
 *    update products_item set price = new_price, price_date = current timestamp where id = id;
 *    insert into price_history (item_id, price) values (id, new_price);
 * insert into products_tracklist if it does not exist yet.

No comments:

Post a Comment