From: Ben Pfaff Date: Sat, 29 Jan 2022 02:23:47 +0000 (-0800) Subject: Fix subtotal calculations. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6121aa9828c5d589ec82c06802614da230257670;hp=8e6f8bf3152f9ed166769b32f542b98991db4a4f;p=pspp Fix subtotal calculations. --- diff --git a/src/language/stats/ctables.c b/src/language/stats/ctables.c index edeb97cc28..b57f33f5d7 100644 --- a/src/language/stats/ctables.c +++ b/src/language/stats/ctables.c @@ -2722,17 +2722,16 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) if (level->type == CTL_CATEGORY) { size_t var_idx = level->var_idx; - if (prev->axes[a].cvs[var_idx].category - != cell->axes[a].cvs[var_idx].category) - { - break; - } - else if (!value_equal (&prev->axes[a].cvs[var_idx].value, - &cell->axes[a].cvs[var_idx].value, - var_get_type (nest->vars[var_idx]))) - { - break; - } + const struct ctables_category *c = cell->axes[a].cvs[var_idx].category; + if (prev->axes[a].cvs[var_idx].category != c) + break; + else if (c->type != CCT_SUBTOTAL + && c->type != CCT_HSUBTOTAL + && c->type != CCT_TOTAL + && !value_equal (&prev->axes[a].cvs[var_idx].value, + &cell->axes[a].cvs[var_idx].value, + var_get_type (nest->vars[var_idx]))) + break; } } }