mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[gnc-pricedb] Don't lookup old prices when doing bulk updates
This commit is contained in:
parent
228954c408
commit
08b56e9669
@ -1075,7 +1075,6 @@ add_price(GNCPriceDB *db, GNCPrice *p)
|
|||||||
gnc_commodity *commodity;
|
gnc_commodity *commodity;
|
||||||
gnc_commodity *currency;
|
gnc_commodity *currency;
|
||||||
GHashTable *currency_hash;
|
GHashTable *currency_hash;
|
||||||
GNCPrice *old_price;
|
|
||||||
|
|
||||||
if (!db || !p) return FALSE;
|
if (!db || !p) return FALSE;
|
||||||
ENTER ("db=%p, pr=%p dirty=%d destroying=%d",
|
ENTER ("db=%p, pr=%p dirty=%d destroying=%d",
|
||||||
@ -1112,9 +1111,11 @@ add_price(GNCPriceDB *db, GNCPrice *p)
|
|||||||
* add this one. If this price is of equal or better precedence than the old
|
* add this one. If this price is of equal or better precedence than the old
|
||||||
* one, copy this one over the old one.
|
* one, copy this one over the old one.
|
||||||
*/
|
*/
|
||||||
old_price = gnc_pricedb_lookup_day_t64 (db, p->commodity, p->currency,
|
if (!db->bulk_update)
|
||||||
p->tmspec);
|
{
|
||||||
if (!db->bulk_update && old_price != NULL)
|
GNCPrice *old_price = gnc_pricedb_lookup_day_t64(db, p->commodity,
|
||||||
|
p->currency, p->tmspec);
|
||||||
|
if (old_price != NULL)
|
||||||
{
|
{
|
||||||
if (p->source > old_price->source)
|
if (p->source > old_price->source)
|
||||||
{
|
{
|
||||||
@ -1124,6 +1125,7 @@ add_price(GNCPriceDB *db, GNCPrice *p)
|
|||||||
}
|
}
|
||||||
gnc_pricedb_remove_price(db, old_price);
|
gnc_pricedb_remove_price(db, old_price);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
|
currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
|
||||||
if (!currency_hash)
|
if (!currency_hash)
|
||||||
|
Loading…
Reference in New Issue
Block a user