This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-513
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft-website.git
The following commit(s) were added to refs/heads/NLPCRAFT-513 by this push:
new 0b02de4 WIP.
0b02de4 is described below
commit 0b02de41f63a09cf142b584951520925f5566807
Author: skhdl <[email protected]>
AuthorDate: Thu Oct 27 14:21:58 2022 +0400
WIP.
---
examples/pizzeria.html | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/examples/pizzeria.html b/examples/pizzeria.html
index 52fbd0f..50e8727 100644
--- a/examples/pizzeria.html
+++ b/examples/pizzeria.html
@@ -214,35 +214,35 @@ fa_icon: fa-cube
def isValid: Boolean = !isEmpty && findPizzaWithoutSize.isEmpty
def add(ps: Seq[Pizza], ds: Seq[Drink]): Unit =
- def setByName[T <: OrderPosition](buf:
mutable.ArrayBuffer[T], t: T): Unit =
+ def setByName[T <: OrderPosition](buf:
mutable.ArrayBuffer[T], t: T): Unit =
buf.find(_.name == t.name) match
- case Some(foundT) => if t.qty.nonEmpty then
foundT.qty = t.qty
- case None => buf += t
+ case Some(foundT) => if t.qty.nonEmpty then
foundT.qty = t.qty
+ case None => buf += t
- for (p <- ps)
- def setPizza(pred: Pizza => Boolean, notFound: => ()
=> Unit): Unit =
+ for (p <- ps)
+ def setPizza(pred: Pizza => Boolean, notFound:
=> () => Unit): Unit =
pizzas.find(pred) match
- case Some(foundPizza) =>
+ case Some(foundPizza) =>
if p.size.nonEmpty then foundPizza.size =
p.size
if p.qty.nonEmpty then foundPizza.qty =
p.qty
- case None => notFound()
+ case None => notFound()
if p.size.nonEmpty then setPizza(
- x => x.name == p.name && x.size == p.size,
- () => setPizza(x => x.name == p.name &&
x.size.isEmpty, () => pizzas += p)
+ x => x.name == p.name && x.size == p.size,
+ () => setPizza(x => x.name == p.name &&
x.size.isEmpty, () => pizzas += p)
)
else setByName(pizzas, p)
- for (d <- ds) setByName(drinks, d)
+ for (d <- ds) setByName(drinks, d)
def findPizzaWithoutSize: Option[Pizza] =
pizzas.find(_.size.isEmpty)
def fixPizzaWithoutSize(size: String): Boolean =
findPizzaWithoutSize match
- case Some(p) =>
+ case Some(p) =>
p.size = size.?
true
- case None => false
+ case None => false
def getState: PizzeriaOrderState = state