2003-02-01 Christian Stimming <stimming@tuhh.de>

* src/import-export/import-backend.c: Reduced the
	MATCH_DATE_NOT_THRESHOLD to 21 days. Yeah, this should rather be a
	user preference, but IMHO three weeks should already cover the
	basic problem.

	* src/import-export/import-account-matcher.c, import-backend.c,
	import-main-matcher.c, import-match-picker.c: Comment out
	stderr debugging output.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7912 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2003-02-01 22:43:26 +00:00
parent 2867bbcab2
commit 6131631a78
5 changed files with 32 additions and 22 deletions

View File

@ -1,5 +1,14 @@
2003-02-01 Christian Stimming <stimming@tuhh.de> 2003-02-01 Christian Stimming <stimming@tuhh.de>
* src/import-export/import-backend.c: Reduced the
MATCH_DATE_NOT_THRESHOLD to 21 days. Yeah, this should rather be a
user preference, but IMHO three weeks should already cover the
basic problem.
* src/import-export/import-account-matcher.c, import-backend.c,
import-main-matcher.c, import-match-picker.c: Comment out
stderr debugging output.
* src/import-export/generic-import.scm: Move transaction matcher * src/import-export/generic-import.scm: Move transaction matcher
preferences to "Online Banking & Import" preference page. preferences to "Online Banking & Import" preference page.

View File

@ -162,7 +162,7 @@ static void
gnc_ui_generic_account_picker_new_cb(GtkButton * w, gpointer user_data) { gnc_ui_generic_account_picker_new_cb(GtkButton * w, gpointer user_data) {
struct _accountpickerdialog * picker = user_data; struct _accountpickerdialog * picker = user_data;
GList * valid_types = NULL; GList * valid_types = NULL;
DEBUG("Begin"); /*DEBUG("Begin"); */
if(picker->new_account_default_type!=NO_TYPE) if(picker->new_account_default_type!=NO_TYPE)
{ {
@ -242,7 +242,7 @@ Account * gnc_import_select_account(char * account_online_id_value,
picker->new_account_default_type = new_account_default_type; picker->new_account_default_type = new_account_default_type;
picker->selected_acct=default_selection; picker->selected_acct=default_selection;
DEBUG("Looking for account with online_id: %s", account_online_id_value); /*DEBUG("Looking for account with online_id: %s", account_online_id_value);*/
if(account_online_id_value!=NULL) if(account_online_id_value!=NULL)
{ {
retval = xaccGroupForEachAccount(picker->acct_group, retval = xaccGroupForEachAccount(picker->acct_group,
@ -308,9 +308,9 @@ Account * gnc_import_select_account(char * account_online_id_value,
{ {
ok_pressed_retval=TRUE; /* There was no dialog involved, so the computer "pressed" ok */ ok_pressed_retval=TRUE; /* There was no dialog involved, so the computer "pressed" ok */
} }
printf("WRITEME: gnc_import_select_account() Here we should check if account type is compatible, currency matches, etc.\n"); /*FIXME: DEBUG("WRITEME: gnc_import_select_account() Here we should check if account type is compatible, currency matches, etc.\n"); */
g_free(picker); g_free(picker);
DEBUG("Return value: %p%s%s%s",retval,", account name:",xaccAccountGetName(retval),"\n"); /*DEBUG("Return value: %p%s%s%s",retval,", account name:",xaccAccountGetName(retval),"\n");*/
if(ok_pressed!=NULL) if(ok_pressed!=NULL)
{ {
*ok_pressed=ok_pressed_retval; *ok_pressed=ok_pressed_retval;

View File

@ -55,7 +55,7 @@ static short module = MOD_IMPORT;
\********************************************************************/ \********************************************************************/
static const int MATCH_DATE_THRESHOLD=4; /*within 4 days*/ static const int MATCH_DATE_THRESHOLD=4; /*within 4 days*/
static const int MATCH_DATE_NOT_THRESHOLD = 25; static const int MATCH_DATE_NOT_THRESHOLD = 21;
/**Transaction's who have an online_id kvp frame have been downloaded /**Transaction's who have an online_id kvp frame have been downloaded
online can probably be skipped in the match list, since it is very online can probably be skipped in the match list, since it is very
unlikely that they would match a transaction downloaded at a later unlikely that they would match a transaction downloaded at a later
@ -444,7 +444,7 @@ static void split_find_match (GNCImportTransInfo * trans_info,
xaccSplitGetAmount(split))) xaccSplitGetAmount(split)))
{ {
prob = prob+3; prob = prob+3;
DEBUG("heuristics: probability + 3 (amount)"); /*DEBUG("heuristics: probability + 3 (amount)");*/
} }
else if (fabs (downloaded_split_amount - match_split_amount) <= else if (fabs (downloaded_split_amount - match_split_amount) <=
fuzzy_amount_difference) fuzzy_amount_difference)
@ -453,7 +453,7 @@ static void split_find_match (GNCImportTransInfo * trans_info,
So you withdraw 100$ and get charged 101,25$ in the same So you withdraw 100$ and get charged 101,25$ in the same
transaction */ transaction */
prob = prob+2; prob = prob+2;
DEBUG("heuristics: probability + 2 (amount)"); /*DEBUG("heuristics: probability + 2 (amount)");*/
} }
else else
{ {
@ -478,19 +478,19 @@ static void split_find_match (GNCImportTransInfo * trans_info,
if (datediff_day == 0) if (datediff_day == 0)
{ {
prob = prob+3; prob = prob+3;
DEBUG("heuristics: probability + 3 (date)"); /*DEBUG("heuristics: probability + 3 (date)");*/
} }
else if (datediff_day <= MATCH_DATE_THRESHOLD) else if (datediff_day <= MATCH_DATE_THRESHOLD)
{ {
prob = prob+2; prob = prob+2;
DEBUG("heuristics: probability + 2 (date)"); /*DEBUG("heuristics: probability + 2 (date)");*/
} }
else if (datediff_day > MATCH_DATE_NOT_THRESHOLD) else if (datediff_day > MATCH_DATE_NOT_THRESHOLD)
{ {
/* Extra penalty if that split lies awfully far away /* Extra penalty if that split lies awfully far away
from the given one. */ from the given one. */
prob = prob-10; prob = prob-10;
DEBUG("heuristics: probability - 10 (date)"); /*DEBUG("heuristics: probability - 10 (date)"); */
} }
@ -513,7 +513,7 @@ static void split_find_match (GNCImportTransInfo * trans_info,
number some banks seem to include in the memo but someone number some banks seem to include in the memo but someone
should write something more sophisticated */ should write something more sophisticated */
prob = prob+1; prob = prob+1;
DEBUG("heuristics: probability + 1 (memo)"); /*DEBUG("heuristics: probability + 1 (memo)"); */
} }
/* Description heuristics */ /* Description heuristics */
@ -524,7 +524,7 @@ static void split_find_match (GNCImportTransInfo * trans_info,
{ {
/*An exact match of Description gives a +2 */ /*An exact match of Description gives a +2 */
prob = prob+2; prob = prob+2;
DEBUG("heuristics: probability + 2 (description)"); /*DEBUG("heuristics: probability + 2 (description)");*/
} }
else if((strncmp(xaccTransGetDescription else if((strncmp(xaccTransGetDescription
(gnc_import_TransInfo_get_trans (trans_info)), (gnc_import_TransInfo_get_trans (trans_info)),
@ -538,7 +538,7 @@ static void split_find_match (GNCImportTransInfo * trans_info,
number some banks seem to include in the memo but someone number some banks seem to include in the memo but someone
should write something more sophisticated */ should write something more sophisticated */
prob = prob+1; prob = prob+1;
DEBUG("heuristics: probability + 1 (description)"); /*DEBUG("heuristics: probability + 1 (description)"); */
} }
if ((gnc_import_get_trans_online_id(xaccSplitGetParent(split))!=NULL) && if ((gnc_import_get_trans_online_id(xaccSplitGetParent(split))!=NULL) &&

View File

@ -285,7 +285,7 @@ clist_select_row_cb (GtkCList *clist,
GNCImportMainMatcher *gui = user_data; GNCImportMainMatcher *gui = user_data;
GNCImportTransInfo *trans_info; GNCImportTransInfo *trans_info;
gboolean should_refresh = TRUE; gboolean should_refresh = TRUE;
DEBUG("row_number: %d%s%d",row_number,", column: ",column); /*DEBUG("row_number: %d%s%d",row_number,", column: ",column);*/
trans_info = gtk_clist_get_row_data (clist, row_number); trans_info = gtk_clist_get_row_data (clist, row_number);
if (trans_info == NULL) if (trans_info == NULL)
return; return;
@ -531,7 +531,7 @@ refresh_clist_row (GNCImportMainMatcher *gui,
gchar *tmp,*imbalance; gchar *tmp,*imbalance;
g_assert (gui); g_assert (gui);
g_assert (info); g_assert (info);
DEBUG("Begin"); /*DEBUG("Begin");*/
gnc_gen_trans_list_freeze(gui); gnc_gen_trans_list_freeze(gui);
for (i = 0; i < NUM_COLUMNS_DOWNLOADED_CLIST; i++) for (i = 0; i < NUM_COLUMNS_DOWNLOADED_CLIST; i++)

View File

@ -57,7 +57,8 @@ static const int MATCHER_CLIST_AMOUNT = 2;
static const int MATCHER_CLIST_DESCRIPTION = 3; static const int MATCHER_CLIST_DESCRIPTION = 3;
static const int MATCHER_CLIST_MEMO = 4; static const int MATCHER_CLIST_MEMO = 4;
static short module = MOD_IMPORT; /* Needs to be commented in again if any DEBUG() macro is used here. */
/*static short module = MOD_IMPORT;*/
/********************************************************************\ /********************************************************************\
* Constants, should idealy be defined a user preference dialog * * Constants, should idealy be defined a user preference dialog *
@ -89,7 +90,7 @@ downloaded_transaction_append(GNCImportMatchPicker * matcher,
g_assert(matcher); g_assert(matcher);
g_assert(transaction_info); g_assert(transaction_info);
DEBUG("Begin"); /*DEBUG("Begin");*/
row_number = gtk_clist_find_row_from_data(matcher->downloaded_clist, row_number = gtk_clist_find_row_from_data(matcher->downloaded_clist,
transaction_info); transaction_info);
@ -150,7 +151,7 @@ downloaded_transaction_select_cb (GtkCList *clist,
GList * list_element; GList * list_element;
gint row_number; gint row_number;
const char * clist_text[NUM_COLUMNS_MATCHER_CLIST]; const char * clist_text[NUM_COLUMNS_MATCHER_CLIST];
DEBUG("row: %d%s%d",row,", column: ",column); /*DEBUG("row: %d%s%d",row,", column: ",column);*/
matcher->selected_trans_info = gtk_clist_get_row_data(clist, row); matcher->selected_trans_info = gtk_clist_get_row_data(clist, row);
@ -243,7 +244,7 @@ match_transaction_select_cb (GtkCList *clist,
GdkEventButton *event, GdkEventButton *event,
gpointer user_data) { gpointer user_data) {
GNCImportMatchPicker * matcher = user_data; GNCImportMatchPicker * matcher = user_data;
DEBUG("row: %d%s%d",row,", column: ",column); /*DEBUG("row: %d%s%d",row,", column: ",column);*/
matcher->selected_match_info = matcher->selected_match_info =
gtk_clist_get_row_data(clist, row); gtk_clist_get_row_data(clist, row);
} }
@ -255,7 +256,7 @@ match_transaction_unselect_cb(GtkCList *clist,
GdkEventButton *event, GdkEventButton *event,
gpointer user_data) { gpointer user_data) {
GNCImportMatchPicker * matcher = user_data; GNCImportMatchPicker * matcher = user_data;
DEBUG("row: %d%s%d",row,", column: ",column); /*DEBUG("row: %d%s%d",row,", column: ",column);*/
matcher->selected_match_info=NULL; matcher->selected_match_info=NULL;
} }
@ -358,10 +359,10 @@ gnc_import_match_picker_run_and_close (GNCImportTransInfo *transaction_info)
old = gnc_import_TransInfo_get_selected_match(transaction_info); old = gnc_import_TransInfo_get_selected_match(transaction_info);
/* Let this dialog run and close. */ /* Let this dialog run and close. */
DEBUG("Right before run and close"); /*DEBUG("Right before run and close");*/
result = result =
gnome_dialog_run_and_close (GNOME_DIALOG (matcher->transaction_matcher)); gnome_dialog_run_and_close (GNOME_DIALOG (matcher->transaction_matcher));
DEBUG("Right after run and close"); /*DEBUG("Right after run and close");*/
/* DEBUG("Result was %d.", result); */ /* DEBUG("Result was %d.", result); */
if (result == 0 && matcher->selected_match_info != old) if (result == 0 && matcher->selected_match_info != old)
{ /* OK was pressed */ { /* OK was pressed */