Exemplo n.º 1
0
def compute_potentials():
    logging.info('Computing potentials for each item.')
    for item in Item.objects.all():
        logging.debug('Computing potential for item #%i' % item.rs_id)
        p, new = Potential.objects.get_or_create(item=item, update=latest_update())
        p.potential = compute_potential(item)
        p.members = item.members
        p.save()
Exemplo n.º 2
0
def parse_detail(item):
    info = get_detail_info_from_id(item.rs_id)
    item.examine = info[3]
    item.save()
    price = get_or_create_price(item, latest_update())
    price.min_price = info[0]
    price.price = info[1]
    price.max_price = info[2]
    price.save()
Exemplo n.º 3
0
def loop_and_parse_front_volumes():
    logging.info('Updating volume info.')
    for info in get_front_volume_info():
        item = Item.objects.get(rs_id=info[0])
        try:
            price = Price.objects.get(item=item, update=latest_update())
            logging.debug('Updating the info for ID #%i' % item.rs_id)
            price.volume = info[1]
            price.save()
        except Price.DoesNotExist: pass
Exemplo n.º 4
0
def loop_and_parse_front_volumes():
    logging.info('Updating volume info.')
    for info in get_front_volume_info():
        item = Item.objects.get(rs_id=info[0])
        try:
            price = Price.objects.get(item=item, update=latest_update())
            logging.debug('Updating the info for ID #%i' % item.rs_id)
            price.volume = info[1]
            price.save()
        except Price.DoesNotExist:
            pass
Exemplo n.º 5
0
def parse_index(html):
    for raw_item in get_index_info(html):
        try:
            item = Item.objects.get(rs_id=raw_item[0])
            item.name = raw_item[1]
            item.members = raw_item[2]
            item.save()
        except Item.DoesNotExist:
            item = Item(rs_id=raw_item[0], name=raw_item[1], members=raw_item[2])
            item.save()
        price = get_or_create_price(item, latest_update())
        price.price = raw_item[3]
        price.save()