commit 6f11901485a5af44c53a31ebbf4d0e93991983c9
parent 915480618b84f281aaa9bac3f711cf6e5fd555c1
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 31 May 2020 20:55:02 +0200
implement filter
Diffstat:
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
@@ -3840,12 +3840,13 @@ struct LookupReservesContext
void *cb_cls;
/**
- *
+ * Filter by active reserves.
*/
enum TALER_MERCHANTDB_YesNoAll active;
/**
- *
+ * Filter by failures (missmatch in exchange claimed and
+ * merchant claimed initial amounts).
*/
enum TALER_MERCHANTDB_YesNoAll failures;
@@ -3912,6 +3913,32 @@ lookup_reserves_cb (void *cls,
lrc->qs = GNUNET_DB_STATUS_HARD_ERROR;
return;
}
+ switch (lrc->active)
+ {
+ case TALER_MERCHANTDB_YNA_YES:
+ if (! active)
+ continue;
+ case TALER_MERCHANTDB_YNA_NO:
+ if (active)
+ continue;
+ case TALER_MERCHANTDB_YNA_ALL:
+ break;
+ }
+ switch (lrc->failures)
+ {
+ case TALER_MERCHANTDB_YNA_YES:
+ if (0 ==
+ TALER_amount_cmp (&merchant_initial_balance,
+ &exchange_initial_balance))
+ continue;
+ case TALER_MERCHANTDB_YNA_NO:
+ if (0 !=
+ TALER_amount_cmp (&merchant_initial_balance,
+ &exchange_initial_balance))
+ continue;
+ case TALER_MERCHANTDB_YNA_ALL:
+ break;
+ }
lrc->cb (lrc->cb_cls,
&reserve_pub,
creation_time,