From 38c30452c459f6bb5adaeb5482cecb53d0101ac1 Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk>
Date: Sat, 27 Jan 2024 16:49:54 +0000
Subject: [PATCH] Fix creation of wait_block

---
 src/wait.jl | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/wait.jl b/src/wait.jl
index 039098e..f524116 100644
--- a/src/wait.jl
+++ b/src/wait.jl
@@ -20,20 +20,18 @@ Duration can be set to one of:
 struct WaitBlock <: BuildingBlock
     model :: Model
     duration :: VariableType
+    function WaitBlock(model::Model, duration=nothing)
+        res = new(
+            model, 
+            get_free_variable(model, duration),
+        )
+        @constraint model res.duration >= 0
+        return res
+    end
 end
 
 @global_model_constructor WaitBlock
 
-function WaitBlock(model::Model, duration=nothing)
-    res = WaitBlock(
-        model, 
-        get_free_variable(model, duration),
-        VariableType[]
-    )
-    @constraint model duration(res) >= 0
-    return res
-end
-
 """
     to_block(JuMP variable/:min or :max/nothing/number)
 
-- 
GitLab