Commits

Petar Bukvic committed 4304c98

Add drug_product to versioning when custom dosage is included

  • Participants
  • Parent commits f34168d

Comments (0)

Files changed (1)

versioning/utils.py

         original_data = get_field_data(obj2, field)
         new_data = get_field_data(obj1, field)
         if model.__name__ == 'Prescription': 
+            if (field == 'creator' and original_data != new_data):
+                drug_product_field_name = 'drug_product'
+                original_drug_product_data = get_field_data(obj1, drug_product_field_name)
+                new_drug_product_data = get_field_data(obj2, drug_product_field_name)
+                if original_drug_product_data == new_drug_product_data:
+                    lines.extend(["@@@ {0}".format(drug_product_field_name)])
+                    lines.append(new_drug_product_data.strip())
             if (original_data != new_data or field == 'creator'):
                 lines.extend(["@@@ {0}".format(field)])
                 lines.append(new_data.strip())
+            
         else:
             #data_diff = unified_diff(original_data.splitlines(),
             #                         new_data.splitlines(), context=3)