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

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

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

Fix on changeset 1828:69f78fc3b6ae

Bruno M. Villasanti <bvillasanti>In charge of this item.
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>In charge of this item.
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>
Project Member

 

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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    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.7