Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Add non-null to fields #25

Merged
merged 3 commits into from Feb 12, 2017
Merged

Add non-null to fields #25

merged 3 commits into from Feb 12, 2017

Conversation

xuorig
Copy link
Collaborator

@xuorig xuorig commented Feb 12, 2017

forgot about non nulls! Pretty sure all these fields are non-null, havent verified all of them but worst case well fix when we see errors. @cjoudrey

"The birth year of the person, using the in-universe standard of BBY or ABY"\
" - Before the Battle of Yavin or After the Battle of Yavin. The Battle of Yavin"\
" is a battle that occurs at the end of Star Wars episode IV: A New Hope.",
property: :birth_year

field :eyeColor, types.String,
field :eyeColor, !types.String,
Copy link
Contributor

Choose a reason for hiding this comment

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

> Person.where(eye_color: nil).map(&:name)
  Person Load (0.4ms)  SELECT "people".* FROM "people" WHERE "people"."eye_color" IS NULL
=> ["Wat Tambor", "Ratts Tyerell", "Captain Phasma"]

field :homeworld, !Planet, "A planet that this person was born on or inhabits."
field :mass, !types.Int, "The mass of the person in kilograms."
field :name, !types.String, "The name of this person."
field :skinColor, !types.String, "The skin color of this person.", property: :skin_color
Copy link
Contributor

Choose a reason for hiding this comment

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

> Person.where(skin_color: nil).map(&:name)
  Person Load (0.2ms)  SELECT "people".* FROM "people" WHERE "people"."skin_color" IS NULL
=> ["Chewbacca", "Captain Phasma"]

field :mass, types.Int, "The mass of the person in kilograms."
field :name, types.String, "The name of this person."
field :skinColor, types.String, "The skin color of this person.", property: :skin_color
field :height, !types.Int, "The height of the person in centimeters."
Copy link
Contributor

Choose a reason for hiding this comment

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

> Person.where(height: nil).map(&:name)
  Person Load (0.2ms)  SELECT "people".* FROM "people" WHERE "people"."height" IS NULL
=> ["Arvel Crynyd", "BB8", "Poe Dameron", "Rey", "Captain Phasma", "Finn"]

field :skinColor, types.String, "The skin color of this person.", property: :skin_color
field :height, !types.Int, "The height of the person in centimeters."
field :homeworld, !Planet, "A planet that this person was born on or inhabits."
field :mass, !types.Int, "The mass of the person in kilograms."
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here :(

field :name, types.String, "The name of this person."
field :skinColor, types.String, "The skin color of this person.", property: :skin_color
field :height, !types.Int, "The height of the person in centimeters."
field :homeworld, !Planet, "A planet that this person was born on or inhabits."
Copy link
Contributor

Choose a reason for hiding this comment

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

Here too :(

field :name, types.String, "The name of this planet."
field :diameter, types.Int, "The diameter of this planet in kilometers."
field :name, !types.String, "The name of this planet."
field :diameter, !types.Int, "The diameter of this planet in kilometers."
Copy link
Contributor

Choose a reason for hiding this comment

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

> Planet.where(diameter: nil).count
   (0.2ms)  SELECT COUNT(*) FROM "planets" WHERE "planets"."diameter" IS NULL
=> 17

😭


field :rotationPeriod, types.Int,
field :rotationPeriod, !types.Int,
Copy link
Contributor

Choose a reason for hiding this comment

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

> Planet.where(rotation_period: nil).count
   (0.2ms)  SELECT COUNT(*) FROM "planets" WHERE "planets"."rotation_period" IS NULL
=> 13

😭

"The number of standard hours it takes for this planet to complete a single rotation on its axis.",
property: :rotation_period

field :orbitalPeriod, types.Int,
field :orbitalPeriod, !types.Int,
Copy link
Contributor

Choose a reason for hiding this comment

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

> Planet.where(orbital_period: nil).count
   (0.2ms)  SELECT COUNT(*) FROM "planets" WHERE "planets"."orbital_period" IS NULL
=> 13

surprise! 😭

"The number of standard days it takes for this planet to complete a single orbit of its local star.",
property: :orbital_period

field :gravity, types.String,
field :gravity, !types.String,
Copy link
Contributor

Choose a reason for hiding this comment

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

This one too.


field :surfaceWater, types.Float,
field :surfaceWater, !types.Float,
Copy link
Contributor

Choose a reason for hiding this comment

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

population, climate, terrain, surfaceWater. All of these too. 😭

field :classification, types.String, "The classification of this species, such as \"mammal\" or \"reptile\"."
field :designation, types.String, "The designation of this species, such as \"sentient\"."
field :name, !types.String, "The name of this species."
field :classification, !types.String, "The classification of this species, such as \"mammal\" or \"reptile\"."
Copy link
Contributor

Choose a reason for hiding this comment

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

> Species.where(classification: nil).count
   (1.3ms)  SELECT COUNT(*) FROM "species" WHERE "species"."classification" IS NULL
=> 6

field :language, types.String, "The language commonly spoken by this species."
field :homeworld, Graph::Types::Planet, "A planet that this species originates from type."
field :language, !types.String, "The language commonly spoken by this species."
field :homeworld, !Graph::Types::Planet, "A planet that this species originates from type."
Copy link
Contributor

Choose a reason for hiding this comment

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

  (1.9ms)  SELECT COUNT(*) FROM "species" WHERE "species"."homeworld_id" IS NULL
=> 2

description "Common skin colors for this species, null if this species does not typically have skin."
resolve ->(species, _, _) do
return unless colors = species.skin_colors
colors.split(", ")
end
end

field :language, types.String, "The language commonly spoken by this species."
field :homeworld, Graph::Types::Planet, "A planet that this species originates from type."
field :language, !types.String, "The language commonly spoken by this species."
Copy link
Contributor

Choose a reason for hiding this comment

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

   (0.1ms)  SELECT COUNT(*) FROM "species" WHERE "species"."language" IS NULL
=> 1

@xuorig
Copy link
Collaborator Author

xuorig commented Feb 12, 2017

merging, only name is non null except for film

@xuorig xuorig merged commit 7e66c35 into master Feb 12, 2017
@xuorig xuorig deleted the non-null-fields branch February 12, 2017 19:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants