mirror of
https://github.com/fazo96/pbs.git
synced 2025-01-27 14:34:19 +01:00
added a few features
This commit is contained in:
parent
12172f34c4
commit
147973d7bc
@ -11,6 +11,7 @@ buildGraph = (data) ->
|
||||
connections.push
|
||||
from: x.startDay, to: x.endDay
|
||||
label: x.id+" ("+(if x.permittedDelay > 0 then x.duration+"/"+(x.duration+x.permittedDelay) else x.duration)+")"
|
||||
color: if !x.permittedDelay then 'red'
|
||||
if x.permittedDelay > 0
|
||||
connections.push
|
||||
from: x.endDay
|
||||
|
@ -40,6 +40,8 @@ module.exports = class Pert
|
||||
item.depends.forEach (x) =>
|
||||
@log "checking permittedDelay to dependency", x, "of", item
|
||||
i = @toActivity x
|
||||
if !i.dependant? then i.dependant = [item.id]
|
||||
else i.dependant.push item.id
|
||||
if !i.permittedDelay?
|
||||
i.permittedDelay = item.startDay - @calculateEndDay i
|
||||
@log "written permittedDelay to dependency", x, "of", item, "as", i.permittedDelay
|
||||
@ -61,10 +63,15 @@ module.exports = class Pert
|
||||
@list = data
|
||||
return @
|
||||
|
||||
calculate: (options) ->
|
||||
calculate: (options,cb) ->
|
||||
h = @highestID()
|
||||
@list.forEach (x) =>
|
||||
@log '('+x.id+'/'+h+')'
|
||||
@calculateEndDay x
|
||||
results = activities: @list, days: @days
|
||||
if options?.json then JSON.stringify results else results
|
||||
if options?.json
|
||||
if cb? then cb(JSON.stringify results)
|
||||
JSON.stringify results
|
||||
else
|
||||
if cb? then cb(results)
|
||||
results
|
||||
|
Loading…
Reference in New Issue
Block a user