Skip to content

Commit 84a2a64

Browse files
author
Bob Dill
authored
Merge pull request #26 from danjdk/patch-1
Update sample_complete.js
2 parents 82149ab + b43593c commit 84a2a64

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Chapter04/Documentation/answers/lib/sample_complete.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function CreateOrder(purchase) {
5252
* @transaction
5353
*/
5454
function Buy(purchase) {
55-
if (purchase.order.status = JSON.stringify(orderStatus.Created))
55+
if (purchase.order.status == JSON.stringify(orderStatus.Created))
5656
{
5757
purchase.order.buyer = purchase.buyer;
5858
purchase.order.seller = purchase.seller;
@@ -70,7 +70,7 @@ function Buy(purchase) {
7070
* @transaction
7171
*/
7272
function OrderCancel(purchase) {
73-
if ((purchase.order.status = JSON.stringify(orderStatus.Created)) || (purchase.order.status = JSON.stringify(orderStatus.Bought)))
73+
if ((purchase.order.status == JSON.stringify(orderStatus.Created)) || (purchase.order.status == JSON.stringify(orderStatus.Bought)))
7474
{
7575
purchase.order.buyer = purchase.buyer;
7676
purchase.order.seller = purchase.seller;
@@ -88,7 +88,7 @@ function OrderCancel(purchase) {
8888
* @transaction
8989
*/
9090
function OrderFromSupplier(purchase) {
91-
if (purchase.order.status = JSON.stringify(orderStatus.Bought))
91+
if (purchase.order.status == JSON.stringify(orderStatus.Bought))
9292
{
9393
purchase.order.provider = purchase.provider;
9494
purchase.order.ordered = new Date().toISOString();
@@ -105,7 +105,7 @@ function OrderFromSupplier(purchase) {
105105
* @transaction
106106
*/
107107
function RequestShipping(purchase) {
108-
if (purchase.order.status = JSON.stringify(orderStatus.Ordered))
108+
if (purchase.order.status == JSON.stringify(orderStatus.Ordered))
109109
{
110110
purchase.order.shipper = purchase.shipper;
111111
purchase.order.requestShipment = new Date().toISOString();
@@ -122,7 +122,7 @@ function RequestShipping(purchase) {
122122
* @transaction
123123
*/
124124
function Delivering(purchase) {
125-
if ((purchase.order.status = JSON.stringify(orderStatus.ShipRequest)) || (JSON.parse(purchase.order.status).code = orderStatus.Delivering.code))
125+
if ((purchase.order.status == JSON.stringify(orderStatus.ShipRequest)) || (JSON.parse(purchase.order.status).code == orderStatus.Delivering.code))
126126
{
127127
purchase.order.delivering = new Date().toISOString();
128128
var _status = orderStatus.Delivering;
@@ -140,7 +140,7 @@ function Delivering(purchase) {
140140
* @transaction
141141
*/
142142
function Deliver(purchase) {
143-
if ((purchase.order.status = JSON.stringify(orderStatus.ShipRequest)) || (JSON.parse(purchase.order.status).code = orderStatus.Delivering.code))
143+
if ((purchase.order.status == JSON.stringify(orderStatus.ShipRequest)) || (JSON.parse(purchase.order.status).code == orderStatus.Delivering.code))
144144
{
145145
purchase.order.delivered = new Date().toISOString();
146146
purchase.order.status = JSON.stringify(orderStatus.Delivered);

0 commit comments

Comments
 (0)