Changeset 3482


Ignore:
Timestamp:
09/08/10 11:46:57 (17 months ago)
Author:
erikroos
Message:

Corrected some major errors in calculation of animal numbers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molgenis_projects/molgenis4phenotype/handwritten/java/plugin/yearlyreportplugin/VWAReport4.java

    r3374 r3482  
    2626        List<String> speciesList = new ArrayList<String>(); 
    2727        private int year; 
     28        private String type; 
    2829         
    2930        public VWAReport4(Database db) { 
     
    3738                try { 
    3839                        this.year = year; 
     40                        this.type = type; 
    3941                         
    4042                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.US); 
     
    6264                                if (valueList.size() > 0) { 
    6365                                        String animalType = valueList.get(0).getValue(); 
    64                                         // Remove animals that are not of the correct type 
     66                                        // Ignore animals that are not of the correct type for this report 
    6567                                        if ((animalType.equals("A. Gewoon dier") && !type.equals("A")) || 
    6668                                                (animalType.equals("B. Transgeen dier") && !type.equals("B")) || 
     
    7072                                                skipAnimal = true; 
    7173                                        } 
     74                                } else { 
     75                                        skipAnimal = true; // Ignore animals that have no type 
    7276                                } 
    7377                                if (skipAnimal) continue; 
    7478                                 
    75                                 // Get status 
     79                                // Get status Alive 
    7680                                boolean aliveEndOfPrevYear = false; 
    7781                                boolean aliveEndOfThisYear = false; 
     
    9498                                                } 
    9599                                        } 
    96                                 } 
     100                                } else { 
     101                                        // Don't consider animals that have (had) no 'Alive' status 
     102                                        skipAnimal = true; 
     103                                } 
     104                                if (skipAnimal) continue; 
     105                                 
     106                                // Get status Dead (if any) 
    97107                                q = db.query(ObservedValue.class); 
    98108                                q.addRules(new QueryRule("observationTarget", Operator.EQUALS, targetid)); 
    99109                                q.addRules(new QueryRule("observableFeature", Operator.EQUALS, featid)); 
    100                                 q.addRules(new QueryRule("value", Operator.EQUALS, "Died")); 
     110                                q.addRules(new QueryRule("value", Operator.EQUALS, "Dead")); 
    101111                                valueList = q.find(); 
    102112                                if (valueList.size() > 0) { 
     
    114124                                        } 
    115125                                } else { 
     126                                        // Born before or in the year of interest and not dead yet 
    116127                                        aliveEndOfThisYear = true; 
    117128                                } 
     
    151162                                        } 
    152163                                } 
    153                         } 
     164                        } // end of loop through all animals 
    154165                        animalList.removeAll(removeList); 
    155166                        // Maybe do extra stuff with this list of relevant animals? 
     
    189200        @Override 
    190201        public String toString() { 
    191                 String output = "<br /><p><strong>Report for the year " + year + "</strong></p>"; 
     202                String output = "<br /><p><strong>Report 4" + type + " for the year " + year + "</strong></p>"; 
    192203                output += "<br /><table border='1' cellpadding='5' cellspacing='5'>"; 
    193204                output += "<tr>"; 
Note: See TracChangeset for help on using the changeset viewer.