X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fctables.c;h=652534ec774e74f23d58b4901ae1b41500886c69;hb=b0634e2d949304323ff1b4230ffed2eed8f7a8b6;hp=c982f19cf63ad431faaf532c0637133daf43b574;hpb=b09f1b74d89c58a78e347262540cc61824607f85;p=pspp diff --git a/src/language/stats/ctables.c b/src/language/stats/ctables.c index c982f19cf6..652534ec77 100644 --- a/src/language/stats/ctables.c +++ b/src/language/stats/ctables.c @@ -186,6 +186,7 @@ struct ctables_cell struct hmap_node node; /* The domains that contain this cell. */ + bool contributes_to_domains; struct ctables_domain *domains[N_CTDTS]; bool hide; @@ -2366,6 +2367,7 @@ ctables_cell_insert__ (struct ctables_table *t, const struct ccase *c, cell = xmalloc (sizeof *cell); cell->hide = false; cell->sv = sv; + cell->contributes_to_domains = true; for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++) { const struct ctables_nest *nest = &t->stacks[a].nests[ix[a]]; @@ -2375,14 +2377,19 @@ ctables_cell_insert__ (struct ctables_table *t, const struct ccase *c, : NULL); for (size_t i = 0; i < nest->n; i++) { + const struct ctables_category *cat = cats[a][i]; + if (i != nest->scale_idx) { - const struct ctables_category *subtotal = cats[a][i]->subtotal; + const struct ctables_category *subtotal = cat->subtotal; if (subtotal && subtotal->type == CCT_HSUBTOTAL) cell->hide = true; + + if (cat->type == CCT_TOTAL || cat->type == CCT_SUBTOTAL || cat->type == CCT_HSUBTOTAL) + cell->contributes_to_domains = false; } - cell->axes[a].cvs[i].category = cats[a][i]; + cell->axes[a].cvs[i].category = cat; value_clone (&cell->axes[a].cvs[i].value, case_data (c, nest->vars[i]), var_get_width (nest->vars[i])); } @@ -2411,8 +2418,9 @@ ctables_cell_add__ (struct ctables_table *t, const struct ccase *c, for (size_t i = 0; i < specs->n; i++) ctables_summary_add (&cell->summaries[i], &specs->specs[i], specs->var, case_data (c, specs->var), weight); - for (enum ctables_domain_type dt = 0; dt < N_CTDTS; dt++) - cell->domains[dt]->valid += weight; + if (cell->contributes_to_domains) + for (enum ctables_domain_type dt = 0; dt < N_CTDTS; dt++) + cell->domains[dt]->valid += weight; } static void