mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-25 00:58:45 +05:00
Added ProcessedProfileIDs in vars for attributes
This commit is contained in:
committed by
Dan Christian Bogos
parent
5350eb5d9a
commit
b41d9ae2d6
@@ -273,9 +273,11 @@ func (alS *AttributeService) V1ProcessEvent(ctx *context.Context, args *AttrArgs
|
||||
processRuns = *args.ProcessRuns
|
||||
}
|
||||
args.CGREvent = args.CGREvent.Clone()
|
||||
processedPrf := make(utils.StringSet)
|
||||
eNV := utils.MapStorage{
|
||||
utils.MetaVars: utils.MapStorage{
|
||||
utils.ProcessRuns: 0,
|
||||
utils.ProcessRuns: 0,
|
||||
utils.ProcessedProfileIDs: processedPrf,
|
||||
},
|
||||
utils.MetaTenant: tnt,
|
||||
}
|
||||
@@ -307,6 +309,7 @@ func (alS *AttributeService) V1ProcessEvent(ctx *context.Context, args *AttrArgs
|
||||
tnt = evRply.CGREvent.Tenant
|
||||
lastID = evRply.MatchedProfiles[0]
|
||||
matchedIDs = append(matchedIDs, lastID)
|
||||
processedPrf.Add(lastID)
|
||||
for _, fldName := range evRply.AlteredFields {
|
||||
alteredFields.Add(fldName)
|
||||
}
|
||||
|
||||
@@ -807,6 +807,7 @@ const (
|
||||
RouteID = "RouteID"
|
||||
MetaMonthlyEstimated = "*monthly_estimated"
|
||||
ProcessRuns = "ProcessRuns"
|
||||
ProcessedProfileIDs = "ProcessedProfileIDs"
|
||||
HashtagSep = "#"
|
||||
MetaRounding = "*rounding"
|
||||
StatsNA = -1.0
|
||||
|
||||
@@ -136,3 +136,28 @@ func (s StringSet) Equals(s2 StringSet) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// added this to implement DataProvieder interface avoid reflect usage in MapStorage
|
||||
|
||||
// String returns the set as a json string ( the fields are not ordered)
|
||||
func (s StringSet) String() string { return ToJSON(s.AsSlice()) }
|
||||
|
||||
// FieldAsInterface returns an empty structure if the path exists else ErrNotFound
|
||||
func (s StringSet) FieldAsInterface(fldPath []string) (interface{}, error) {
|
||||
if len(fldPath) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
val, has := s[fldPath[0]]
|
||||
if !has {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
return val, nil
|
||||
}
|
||||
|
||||
// FieldAsString returns an empty structure as a json string if the path exists else ErrNotFound
|
||||
func (s StringSet) FieldAsString(fldPath []string) (_ string, err error) {
|
||||
if _, err = s.FieldAsInterface(fldPath); err != nil {
|
||||
return
|
||||
}
|
||||
return "{}", nil // noting in it as is a empty structure
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user