bugGNU Health - Bugs: bug #44165, Subtle bug in date of analysis for...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #44165: Subtle bug in date of analysis for lab tests

Submitter:  Chris Zimmerman <teffalump>
Submitted:  Mon 02 Feb 2015 11:38:14 PM UTC
   
 
Category:  Functionality Severity:  2 - Minor
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  bvillasanti
Open/Closed:  Closed Release:  2.7.0
Module:  health_lab Component:  None

Wed 04 Feb 2015 08:11:32 PM UTC, comment #2: 

Fix on changeset 1828:69f78fc3b6ae

Bruno M. Villasanti <bvillasanti>
Tue 03 Feb 2015 04:11:25 PM UTC, comment #1: 

Confirmed.
The default function should be renamed, or eliminated.

Working on it.

Bruno M. Villasanti <bvillasanti>
Mon 02 Feb 2015 11:38:14 PM UTC, original submission:  

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 update_lab_date();

// 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 gnuhealth_lab.id = NEW.gnuhealth_lab_id; END IF; RETURN; END; $$


Chris Zimmerman <teffalump>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bvillasanti (Posted a comment)
  • -email is unavailable- added by teffalump (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-04 bvillasanti StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2015-02-03 bvillasanti StatusNone Confirmed
        Assigned toNone bvillasanti
        ReleaseNone 2.7.0

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code