Rename constraint event
diff --git a/README.md b/README.md
index f1081ce..079d519 100644
--- a/README.md
+++ b/README.md
@@ -116,15 +116,15 @@
## handle unavailable items
-Set the following items "unavailable" (need to specify complete list each time when this list is changed):
+Set the following items as unavailable (need to specify complete list each time when this list is changed):
```
curl -i -X POST http://localhost:7070/events.json?accessKey=zPkr6sBwQoBwBjVHK2hsF9u26L38ARSe19QzkdYentuomCtYSuH0vXP5fq7advo4 \
-H "Content-Type: application/json" \
-d '{
"event" : "$set",
- "entityType" : "itemConstraint"
- "entityId" : "unavailable",
+ "entityType" : "constraint"
+ "entityId" : "unavailableItems",
"properties" : {
"items": ["i43", "i20", "i37", "i3", "i4", "i5"],
}
@@ -132,15 +132,15 @@
}'
```
-No more items "unavailable":
+Set empty list when no more items unavailable:
```
curl -i -X POST http://localhost:7070/events.json?accessKey=zPkr6sBwQoBwBjVHK2hsF9u26L38ARSe19QzkdYentuomCtYSuH0vXP5fq7advo4 \
-H "Content-Type: application/json" \
-d '{
"event" : "$set",
- "entityType" : "itemConstraint"
- "entityId" : "unavailable",
+ "entityType" : "constraint"
+ "entityId" : "unavailableItems",
"properties" : {
"items": [],
}
diff --git a/src/main/scala/ALSAlgorithm.scala b/src/main/scala/ALSAlgorithm.scala
index 73ffa87..e01d31d 100644
--- a/src/main/scala/ALSAlgorithm.scala
+++ b/src/main/scala/ALSAlgorithm.scala
@@ -185,11 +185,11 @@
Set[String]()
}
- // get the latest itemConstraint unavailable $set event
+ // get the latest constraint unavailableItems $set event
val unavailableItems: Set[String] = lEventsDb.findSingleEntity(
appId = ap.appId,
- entityType = "itemConstraint",
- entityId = "unavailable",
+ entityType = "constraint",
+ entityId = "unavailableItems",
eventNames = Some(Seq("$set")),
limit = Some(1),
latest = true,
@@ -203,7 +203,7 @@
}
}
case Left(e) => {
- logger.error(s"Error when read unavailable items: ${e}")
+ logger.error(s"Error when read set unavailableItems event: ${e}")
Set[String]()
}
}