aboutsummaryrefslogtreecommitdiff
path: root/logic/stage.gd
diff options
context:
space:
mode:
authordam <dam@gudinoff>2022-01-06 15:42:44 +0000
committerdam <dam@gudinoff>2022-01-06 15:42:44 +0000
commit431f042390ad36297a5ec986772c77da23b7fb67 (patch)
treece37ed802cf816aa0811bcd90c2b278645d7da33 /logic/stage.gd
parent0eeacf3d142b40427ea5ca5b2806fe714c00f9b4 (diff)
downloadsurgery-log-431f042390ad36297a5ec986772c77da23b7fb67.tar.zst
surgery-log-431f042390ad36297a5ec986772c77da23b7fb67.zip
Remove date field and reduce usage of dictionary instances.
Diffstat (limited to 'logic/stage.gd')
-rw-r--r--logic/stage.gd67
1 files changed, 33 insertions, 34 deletions
diff --git a/logic/stage.gd b/logic/stage.gd
index 511068e..f6f6e47 100644
--- a/logic/stage.gd
+++ b/logic/stage.gd
@@ -7,9 +7,10 @@ signal discard # ()
const FILTERS_FILE_PATH: String = "user://filters.csv"
const POINTER_VELOCITY_DECAYING_FACTOR: float = 2.5
+var staged_entry := {}
+var filters := {}
var is_pointer_dragging := false
var pointer_drag_velocity := 0.0
-var filters := {}
onready var process_id := get_node("controls/process_id") as LineEdit
onready var surgery_id := get_node("controls/surgery_id") as LineEdit
@@ -79,42 +80,40 @@ func discard_action():
func set_stage(entry: Dictionary):
- process_id.text = entry.process_id
- surgery_id.text = entry.surgery_id
- date.set_date(entry.date_year, entry.date_month, entry.date_day)
- place.text = entry.place
- anesthesia.text = entry.anesthesia
- first_assistant.text = entry.first_assistant
- type.text = entry.type
- sub_type.text = entry.sub_type
- sub_sub_type.text = entry.sub_sub_type
- pathology.text = entry.pathology
- intervention.text = entry.intervention
- is_urgency.pressed = entry.is_urgency
- notes.text = entry.notes
- self.scroll_vertical = 0 # @DAM TODO
+ staged_entry = entry.duplicate(true)
+ process_id.text = staged_entry.process_id
+ surgery_id.text = staged_entry.surgery_id
+ date.set_date(staged_entry.date_year, staged_entry.date_month, staged_entry.date_day)
+ place.text = staged_entry.place
+ anesthesia.text = staged_entry.anesthesia
+ first_assistant.text = staged_entry.first_assistant
+ type.text = staged_entry.type
+ sub_type.text = staged_entry.sub_type
+ sub_sub_type.text = staged_entry.sub_sub_type
+ pathology.text = staged_entry.pathology
+ intervention.text = staged_entry.intervention
+ is_urgency.pressed = staged_entry.is_urgency
+ notes.text = staged_entry.notes
+ self.scroll_vertical = 0
func get_stage() -> Dictionary:
- # @DAM Simplify all this... avoid creating multiple entries/dictionaries.
- var entry: Dictionary = {
- "process_id": process_id.text,
- "surgery_id": surgery_id.text,
- "date_year": date.get_year(),
- "date_month": date.get_month(),
- "date_day": date.get_day(),
- "place": place.text,
- "anesthesia": anesthesia.text,
- "first_assistant": first_assistant.text,
- "type": type.text,
- "sub_type": sub_type.text,
- "sub_sub_type": sub_sub_type.text,
- "pathology": pathology.text,
- "intervention": intervention.text,
- "is_urgency": is_urgency.pressed,
- "notes": notes.text,
- }
- return entry
+ staged_entry.process_id = process_id.text
+ staged_entry.surgery_id = surgery_id.text
+ staged_entry.date_year = date.get_year()
+ staged_entry.date_month = date.get_month()
+ staged_entry.date_day = date.get_day()
+ staged_entry.place = place.text
+ staged_entry.anesthesia = anesthesia.text
+ staged_entry.first_assistant= first_assistant.text
+ staged_entry.type = type.text
+ staged_entry.sub_type = sub_type.text
+ staged_entry.sub_sub_type = sub_sub_type.text
+ staged_entry.pathology = pathology.text
+ staged_entry.intervention = intervention.text
+ staged_entry.is_urgency = is_urgency.pressed
+ staged_entry.notes = notes.text
+ return staged_entry
func _notification(what: int):