From 456454e38aae190277eabaaadc601ccf3ed97af3 Mon Sep 17 00:00:00 2001
From: John Darrington <john@darrington.wattle.id.au>
Date: Mon, 23 Aug 2010 17:00:57 +0200
Subject: [PATCH] Oneway: Fix problems with MISSING=ANALYSIS

---
 src/language/stats/oneway.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/language/stats/oneway.c b/src/language/stats/oneway.c
index 69570bbc6b..d08e3114c0 100644
--- a/src/language/stats/oneway.c
+++ b/src/language/stats/oneway.c
@@ -469,16 +469,21 @@ run_oneway (const struct oneway_spec *cmd,
 
       for (i = 0; i < cmd->n_vars; ++i)
 	{
+	  const struct variable *v = cmd->vars[i];
+	  const union value *val = case_data (c, v);
+
+	  if ( MISS_ANALYSIS == cmd->missing_type)
+	    {
+	      if ( var_is_value_missing (v, val, cmd->exclude))
+		continue;
+	    }
+
 	  {
 	    struct per_var_ws *pvw = &ws.vws[i];
 
 	    covariance_accumulate_pass1 (pvw->cov, c);
 	  }
 
-	  const struct variable *v = cmd->vars[i];
-
-	  const union value *val = case_data (c, v);
-
           struct group_proc *gp = group_proc_get (cmd->vars[i]);
 	  struct hsh_table *group_hash = gp->group_hash;
 
@@ -537,6 +542,15 @@ run_oneway (const struct oneway_spec *cmd,
       for (i = 0; i < cmd->n_vars; ++i)
 	{
 	  struct per_var_ws *pvw = &ws.vws[i];
+	  const struct variable *v = cmd->vars[i];
+	  const union value *val = case_data (c, v);
+
+	  if ( MISS_ANALYSIS == cmd->missing_type)
+	    {
+	      if ( var_is_value_missing (v, val, cmd->exclude))
+		continue;
+	    }
+
 	  covariance_accumulate_pass2 (pvw->cov, c);
 	}
     }
-- 
2.30.2