gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] branch master updated: Adding conditions t


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: Adding conditions to add rows in result, based in their index.
Date: Tue, 28 Feb 2017 17:58:00 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 822cef4  Adding conditions to add rows in result, based in their index.
822cef4 is described below

commit 822cef45cd487666b3625c1120716425cfc7662e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Feb 28 17:57:47 2017 +0100

    Adding conditions to add rows in result, based in their index.
---
 src/backend/taler-merchant-httpd_history.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_history.c 
b/src/backend/taler-merchant-httpd_history.c
index c82144b..9361c23 100644
--- a/src/backend/taler-merchant-httpd_history.c
+++ b/src/backend/taler-merchant-httpd_history.c
@@ -36,6 +36,12 @@ unsigned int start;
 unsigned int delta;
 
 /**
+ * Index to the current row being processed.
+ */
+unsigned int current = 0;
+
+
+/**
  * Function called with information about a transaction.
  *
  * @param cls closure
@@ -58,16 +64,23 @@ pd_cb (void *cls,
   json_t *amount;
   json_t *timestamp;
 
+
   GNUNET_assert (NULL != (amount = json_copy (json_object_get (proposal_data, 
"amount"))));
   GNUNET_assert (NULL != (timestamp = json_object_get (proposal_data, 
"timestamp")));
 
-  GNUNET_break (NULL !=
-               (entry = json_pack ("{s:s, s:o, s:s}",
-                                   "order_id", order_id,
-                                   "amount", amount,
-                                   "timestamp", json_string_value 
(timestamp))));
+  if (current >= start && current <= start + delta)
+  {
+    GNUNET_break (NULL != (entry = json_pack ("{s:s, s:o, s:s}",
+                                              "order_id", order_id,
+                                              "amount", amount,
+                                              "timestamp", json_string_value 
(timestamp))));
+
+    GNUNET_break (0 == json_array_append_new (response, entry));
+  
+  }
 
-  GNUNET_break (0 == json_array_append_new (response, entry));
+  // FIXME to zero after returned.
+  current++;
 }
 
 /**
@@ -164,6 +177,7 @@ MH_handler_history (struct TMH_RequestHandler *rh,
                                         &mi->pubkey,
                                         pd_cb,
                                         response);
+  current = 0;
   if (GNUNET_SYSERR == ret)
     return TMH_RESPONSE_reply_internal_error (connection,
                                              TALER_EC_HISTORY_DB_FETCH_ERROR,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]