Skip to content

Conversation

taion
Copy link
Contributor

@taion taion commented Feb 22, 2018

No description provided.

@taion taion requested a review from itajaja February 22, 2018 21:59

enterType(type) {
leaveField() {
this.costFactor /= this.getFieldCostFactor();
Copy link
Member

Choose a reason for hiding this comment

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

every time, i forget this operator exists

item: { type: Item },
expensiveItem: {
type: Item,
getCost: () => 50,
Copy link
Member

Choose a reason for hiding this comment

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

is this safe to extend like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, it works, doesn’t it?

@mxstbr
Copy link

mxstbr commented Feb 23, 2018

How is this going to work if I write in the SDL?

Copy link
Member

@itajaja itajaja left a comment

Choose a reason for hiding this comment

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

great. Does it make sense to set a cost factor in a non list type?

@mxstbr
Copy link

mxstbr commented Feb 23, 2018

Does it make sense to set a cost factor in a non list type?

Yeah for sure, what if one of my fields has to do 10 db queries instead of the usual 1?

type Bla {
  normalField: String # Cheap
  someExtremelyExpensiveField: SomeExtremelyExpensiveObject # Much more expensive
}

@itajaja
Copy link
Member

itajaja commented Feb 23, 2018

wouldn't that be modeled by a constant cost on the field?

@taion
Copy link
Contributor Author

taion commented Feb 23, 2018

I can't think of a use case for cost factor on a non-list field, but I don't think it really matters. I don't see the harm in keeping it around.

@taion
Copy link
Contributor Author

taion commented Feb 24, 2018

@mxstbr I just added SDL support in the latest commit on this PR.

@taion taion merged commit 1c9d552 into master Feb 25, 2018
@taion taion deleted the cost-factor branch February 25, 2018 02:50
@taion
Copy link
Contributor Author

taion commented Feb 25, 2018

Released in v0.2.2.

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.

4 participants