agent SDK fix

This commit is contained in:
m.nazemi
2026-04-12 12:29:35 +03:30
parent fd89371bdf
commit bf3f21fb51
8 changed files with 1186 additions and 20 deletions
+3 -3
View File
@@ -573,13 +573,13 @@ func (w *NoticeWorker) getNextSequentialNumber(ctx context.Context, sourceCode,
// Create aggregation pipeline to find the highest sequential number
pipeline := mongodriver.Pipeline{
bson.D{{"$match", bson.M{
bson.D{{Key: "$match", Value: bson.M{
"tender_id": bson.M{"$regex": pattern},
}}},
bson.D{{"$project", bson.M{
bson.D{{Key: "$project", Value: bson.M{
"sequential_num": bson.M{"$substr": bson.A{"$tender_id", 5, 3}}, // Extract last 3 chars (NNN)
}}},
bson.D{{"$group", bson.M{
bson.D{{Key: "$group", Value: bson.M{
"_id": nil,
"max_num": bson.M{"$max": bson.M{"$toInt": "$sequential_num"}},
}}},