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