diff --git a/doc/order_model.puml b/doc/order_model.puml index 22d9491..9aa7d1c 100644 --- a/doc/order_model.puml +++ b/doc/order_model.puml @@ -194,7 +194,7 @@ AccessPricingProfile ^-- ProcessingResourcePricingProfile ExploitPricingProfile ^-- ComputeResourcePricingProfile ExploitPricingProfile ^-- StorageResourcePricingProfile interface PricingProfileITF { - GetPrice(quantity float64, val float64, start date, end date, request) float64 + GetPriceHT(quantity float64, val float64, start date, end date, request) float64 IsPurchased() bool } class AccessPricingProfile { @@ -319,7 +319,7 @@ Workflow "1 " --* "many " ExploitResourceSet class Workflow {} interface PricedItemITF { - getPrice(request) float64, error + GetPriceHT(request) float64, error } @enduml \ No newline at end of file diff --git a/models/peer/peer.go b/models/peer/peer.go index ac3386a..fecc378 100644 --- a/models/peer/peer.go +++ b/models/peer/peer.go @@ -62,6 +62,7 @@ func IsMySelf(peerID string) (bool, string) { // Peer is a struct that represents a peer type Peer struct { utils.AbstractObject + PeerID string `json:"peer_id" bson:"peer_id" validate:"required"` Url string `json:"url" bson:"url" validate:"required"` // Url is the URL of the peer (base64url) WalletAddress string `json:"wallet_address" bson:"wallet_address" validate:"required"` // WalletAddress is the wallet address of the peer diff --git a/models/workflow/graph/graph.go b/models/workflow/graph/graph.go index 05e4324..588d946 100644 --- a/models/workflow/graph/graph.go +++ b/models/workflow/graph/graph.go @@ -68,7 +68,7 @@ func (wf *Graph) IsWorkflow(item GraphItem) bool { } func (g *Graph) GetAverageTimeRelatedToProcessingActivity(start time.Time, processings []*resources.ProcessingResource, resource resources.ResourceInterface, - f func(GraphItem) resources.ResourceInterface, instance int, bookingMode int, request *tools.APIRequest) (float64, float64, error) { + f func(GraphItem) resources.ResourceInterface, instance int, partnership int, buying int, strategy int, bookingMode int, request *tools.APIRequest) (float64, float64, error) { nearestStart := float64(10000000000) oneIsInfinite := false longestDuration := float64(0) @@ -80,7 +80,7 @@ func (g *Graph) GetAverageTimeRelatedToProcessingActivity(start time.Time, proce } else if link.Source.ID == processing.GetID() && f(g.Items[link.Source.ID]) != nil && f(g.Items[link.Source.ID]).GetID() == resource.GetID() { // if the source is the processing and the destination is not a compute source = link.Destination.ID } - priced, err := processing.ConvertToPricedResource(tools.PROCESSING_RESOURCE, &instance, &bookingMode, request) + priced, err := processing.ConvertToPricedResource(tools.PROCESSING_RESOURCE, &instance, &partnership, &buying, &strategy, &bookingMode, request) if err != nil { return 0, 0, err } @@ -112,7 +112,8 @@ func (g *Graph) GetAverageTimeRelatedToProcessingActivity(start time.Time, proce /* * GetAverageTimeBeforeStart is a function that returns the average time before the start of a processing */ -func (g *Graph) GetAverageTimeProcessingBeforeStart(average float64, processingID string, instance int, bookingMode int, request *tools.APIRequest) (float64, error) { +func (g *Graph) GetAverageTimeProcessingBeforeStart(average float64, processingID string, + instance int, partnership int, buying int, strategy int, bookingMode int, request *tools.APIRequest) (float64, error) { currents := []float64{} // list of current time for _, link := range g.Links { // for each link var source string // source is the source of the link @@ -128,7 +129,7 @@ func (g *Graph) GetAverageTimeProcessingBeforeStart(average float64, processingI if r == nil { // if item is nil, continue continue } - priced, err := r.ConvertToPricedResource(dt, &instance, &bookingMode, request) + priced, err := r.ConvertToPricedResource(dt, &instance, &partnership, &buying, &strategy, &bookingMode, request) if err != nil { return 0, err } @@ -136,7 +137,7 @@ func (g *Graph) GetAverageTimeProcessingBeforeStart(average float64, processingI if current < 0 { // if current is negative, its means that duration of a before could be infinite continue return current, nil } - add, err := g.GetAverageTimeProcessingBeforeStart(current, source, instance, bookingMode, request) + add, err := g.GetAverageTimeProcessingBeforeStart(current, source, instance, partnership, buying, strategy, bookingMode, request) if err != nil { return 0, err }