[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Health-dev] [bug #44165] Subtle bug in date of analysis for lab tests

From: Chris Zimmerman
Subject: [Health-dev] [bug #44165] Subtle bug in date of analysis for lab tests
Date: Mon, 02 Feb 2015 23:38:15 +0000
User-agent: Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0


                 Summary: Subtle bug in date of analysis for lab tests
                 Project: GNU Health
            Submitted by: teffalump
            Submitted on: Mon Feb  2 23:38:14 2015
                Category: Functionality
                Severity: 2 - Minor
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None
                  Module: health_lab



It is possible for lab tests to have values, but no date_analysis. Or
date_analysis to be set, and no values.

Simple solution: rename class method default_analysis (typo?) to
default_date_analysis. Still, no table checks.

Fuller solution: Something like this (forgive typos) on the results table....

// This creates a trigger on any updates on the result column
CREATE TRIGGER constrain_date_and_results AFTER UPDATE OF result ON
gnuhealth_lab_test_critearea FOR EACH ROW EXECUTE PROCEDURE

// This function updates the date, if not null, when a new result is not null
CREATE OR REPLACE FUNCTION update_lab_date() RETURNS trigger as $$ BEGIN IF
NEW.result IS NOT NULL THEN UPDATE gnuhealth_lab SET date_analysis =
COALESCE(date_analysis, now()) WHERE = NEW.gnuhealth_lab_id;


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]