-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.puml
117 lines (95 loc) · 3.03 KB
/
view.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
@startgantt
'Section to start listing tasks
!procedure $json_title($json_in)
!if %json_key_exists($json_in, startDate)
project starts $json_in.startDate
!endif
!endprocedure
' setup closed days and days off
!procedure $json_setupweeks($json_in)
!if %json_key_exists($json_in, closedDays)
!foreach $day in $json_in.closedDays
!if %json_key_exists($day, day)
$day.day are closed
!endif
!if %json_key_exists($day, date)
$day.date is closed
!endif
!endfor
!endif
!endprocedure
' rendering tasks
!procedure $json2task($json_in)
!foreach $ta in $json_in.tasks
!if ($ta.id > 0)
!$strvar = ""
!if %json_key_exists($ta, resources)
!$strvar = $strvar + "on "
!foreach $re in $ta.resources
!$strvar = $strvar + "{"
!$strvar = $strvar + $re.name:$re.percent%
!$strvar = $strvar + "}"
!endfor
!endif
[$ta.description] $strvar requires $ta.duration days
!endif
!endfor
!endprocedure
' add starting constraint for tasks
!procedure $json_startdate($json_in)
!foreach $ta in $json_in.tasks
!if %json_key_exists($ta, starts)
[$ta.description] starts %string($ta.starts)
!endif
!endfor
!endprocedure
'section to add in precedding tasks
!procedure $json_end2start($json_in)
!foreach $ts in $projson.tasks
!if (%json_key_exists($ts, predecessors))
!if (%get_json_type($ts.predecessors) == "array")
!foreach $pr in $ts.predecessors
!foreach $tf in $projson.tasks
!if ($pr == $tf.id)
[$tf.description] -> [$ts.description]
!endif
!endfor
!endfor
!else !if (%get_json_type($ts.predecessors) == "number")
!foreach $tf2 in $projson.tasks
!if ($ts.predecessors == $tf2.id)
[$tf2.description] -> [$ts.description]
!endif
!endfor
!endif
!endif
!endfor
!endprocedure
'task completeion listings
!procedure $json_completion($json_in)
!foreach $ts in $json_in.tasks
!if %json_key_exists($ts, completed)
[$ts.description] is $ts.completed% completed
!else
[$task.description] is 0% completed
!endif
!endfor
!endprocedure
!procedure $json2title($json_in)
!if %json_key_exists($json_in, projectName)
title $projson.projectName
!endif
!endprocedure
!procedure $json2chart($json_in)
$json_title($json_in)
$json_setupweeks($json_in)
$json2task($json_in)
$json_startdate($json_in)
$json_end2start($json_in)
$json_completion($json_in)
$json2title($json_in)
footer Made by PUML Strings: Gantt
!endprocedure
!$projson = %load_json(tasks.json)
$json2chart($projson)
@endgantt