From 484653b70e9ddc0100c8eb1cccccb2ad1ccd7824 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 14 Aug 2022 15:51:41 -0700 Subject: [PATCH] pivot-table: fix split file support --- src/output/pivot-table.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/output/pivot-table.c b/src/output/pivot-table.c index ec652e50de..f81be9df22 100644 --- a/src/output/pivot-table.c +++ b/src/output/pivot-table.c @@ -3165,7 +3165,7 @@ pivot_splits_new_split (struct pivot_splits *ps, const struct ccase *example) if (!ps) return; - size_t n_new = 0; + size_t n_changed = 0; for (size_t i = 0; i < ps->n; i++) { struct pivot_splits_var *psvar = &ps->vars[i]; @@ -3180,13 +3180,16 @@ pivot_splits_new_split (struct pivot_splits *ps, const struct ccase *example) psval->leaf = pivot_category_create_leaf ( psvar->dimension->root, pivot_value_new_var_value (psvar->var, value)); - n_new++; } - ps->dindexes[i] = psval->leaf; + if (ps->dindexes[i] != psval->leaf) + { + ps->dindexes[i] = psval->leaf; + n_changed++; + } } - if (!n_new) + if (!n_changed) { if (ps->warnings_left-- > 0) { @@ -3231,7 +3234,7 @@ pivot_splits_get_dindexes (const struct pivot_splits *ps, size_t *dindexes) assert (ps->dindexes[0] != SIZE_MAX); for (size_t i = 0; i < ps->n; i++) - dindexes[i] = ps->dindexes[i]; + dindexes[ps->n - i - 1] = ps->dindexes[i]; return ps->n; } -- 2.30.2