Skip to content

implemented spec for confectionery#49

Open
Rachel-Susholz wants to merge 2 commits into
CPU-Code-School:mainfrom
Rachel-Susholz:main
Open

implemented spec for confectionery#49
Rachel-Susholz wants to merge 2 commits into
CPU-Code-School:mainfrom
Rachel-Susholz:main

Conversation

@Rachel-Susholz
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Contributor

@AvigailGellis AvigailGellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing job! See comments, fix and resubmit.

Comment thread 1 Table.sql Outdated
(Topping in ('royal icing', 'fondant', 'chocolate', 'caramel', 'strawberry', 'coconut', 'peanut butter', 'no topping')) ,
CustomSpecification varchar (350) not null
default '',
Photo varchar (3) not null
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Photo should be a bit column

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I changed that.

Comment thread 1 Table.sql Outdated
Occasion varchar (50) not null
default '',

constraint c_confectionery_when_product_type_is_cookie_base_must_be_sugar check ((ProductType = 'cookie' and BaseType ='sugar') or (ProductType in ('cake', 'cupcake'))),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't say anywhere that cookies must be sugar. I see the sample data only includes sugar cookies but that doesn't mean there is no option for other bases.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this constraint.

Comment thread 1 Table.sql Outdated
default '',

constraint c_confectionery_when_product_type_is_cookie_base_must_be_sugar check ((ProductType = 'cookie' and BaseType ='sugar') or (ProductType in ('cake', 'cupcake'))),
constraint c_confectionery_amount_must_be_between_twelve_and_five_hundred_when_the_product_type_is_cupcake check ((ProductType = 'cupcake' and Amount between 12 and 500)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constraint message only includes the first part of the constraint.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completed the constraint message.

Comment thread 1 Table.sql Outdated
Photo varchar (3) not null
constraint c_confectionery_photo_must_be_either_yes_or_no check (Photo in ('yes', 'no')),
Amount int not null,
CostPerItem decimal (4,2) not null,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the instructions of what each item should cost (based off of product type and picture) is written out fully in the spec, this column should be a computed column. This should replace the constraints you have below about the pricing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I created a computed column for the total cost.

Comment thread 1 Table.sql
Amount int not null,
CostPerItem decimal (4,2) not null,
TotalCost decimal (6,2) not null,
Occasion varchar (50) not null
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Occasion should not allow blanks

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, it does not allow blanks now.

Comment thread 1 Table.sql Outdated
constraint c_confectionery_photo_must_be_either_yes_or_no check (Photo in ('yes', 'no')),
Amount int not null,
CostPerItem decimal (4,2) not null,
TotalCost decimal (6,2) not null,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total cost should also be a computed column. However, since you can't make a computed column off of another computed column, you will have the same calculation you make for CostPerItem and then just multiply it by the amount.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, thanks for the tip!

Comment thread 2 Data.sql Outdated
delete confectionery
go

insert Confectionery (CustomerFirstName, CustomerLastName, Branch, OrderDate, BaseType, ProductType, Topping, Photo, CustomSpecification, Occasion, Amount, CostPerItem, TotalCost)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put in all the sample data provided.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I inserted all the sample data.

Comment thread 3 Reports.sql
@@ -0,0 +1,42 @@
--1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Insert alias's in all your questions.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alias's were inserted

Comment thread 1 Table.sql Outdated
drop table if exists Confectionery
go

create table dbo.Confectionery(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A clearer name for such a table would be Orders.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the table name to orders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants