Plant#plant_stage
parent
d90c29af8a
commit
661430298c
|
@ -7,6 +7,7 @@
|
|||
module CeleryScriptSettingsBag
|
||||
# List of all celery script nodes that can be used as a varaible...
|
||||
ANY_VARIABLE = [:tool, :coordinate, :point, :identifier]
|
||||
PLANT_STAGES = %w(planned planted harvested)
|
||||
ALLOWED_PIN_MODES = [DIGITAL = 0, ANALOG = 1]
|
||||
ALLOWED_PIN_TYPES = [Peripheral, Sensor].map(&:name)
|
||||
ALLOWED_RPC_NODES = %w(home emergency_lock emergency_unlock read_status
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
class PointSerializer < ActiveModel::Serializer
|
||||
attributes :id, :created_at, :updated_at, :device_id, :meta, :name,
|
||||
:pointer_type, :radius, :x, :y, :z
|
||||
|
||||
attribute :openfarm_slug, if: :plant?
|
||||
attribute :planted_at, if: :plant?
|
||||
attribute :plant_stage, if: :plant?
|
||||
attribute :tool_id, if: :tool_slot?
|
||||
attribute :pullout_direction, if: :tool_slot?
|
||||
|
||||
|
@ -26,6 +28,10 @@ class PointSerializer < ActiveModel::Serializer
|
|||
object.pointer.planted_at
|
||||
end
|
||||
|
||||
def plant_stage
|
||||
object.pointer.plant_stage
|
||||
end
|
||||
|
||||
def pullout_direction
|
||||
object.pointer.pullout_direction
|
||||
end
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class AddPlantStageToPlants < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :plants, :plant_stage, :string, limit: 10, default: "planned",
|
||||
presence: true
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20180301222052) do
|
||||
ActiveRecord::Schema.define(version: 20180305170608) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -260,6 +260,7 @@ ActiveRecord::Schema.define(version: 20180301222052) do
|
|||
t.string "openfarm_slug", limit: 280, default: "50", null: false
|
||||
t.datetime "created_at"
|
||||
t.datetime "planted_at"
|
||||
t.string "plant_stage", limit: 10, default: "planned"
|
||||
t.index ["created_at"], name: "index_plants_on_created_at"
|
||||
end
|
||||
|
||||
|
|
|
@ -131,6 +131,7 @@ class CorpusEmitter
|
|||
result.push(enum_type :DataChangeType, CeleryScriptSettingsBag::ALLOWED_CHAGES)
|
||||
result.push(enum_type :PointType, CeleryScriptSettingsBag::ALLOWED_POINTER_TYPE)
|
||||
result.push(enum_type :AllowedPinTypes, CeleryScriptSettingsBag::ALLOWED_PIN_TYPES)
|
||||
result.push(enum_type :PlantStage, CeleryScriptSettingsBag::PLANT_STAGES)
|
||||
|
||||
File.open("latest_corpus.ts", "w") do |f|
|
||||
f.write(result.join.gsub("\n\n\n", "\n").gsub("\n\n", "\n").strip)
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
"enzyme": "^3.1.0",
|
||||
"enzyme-adapter-react-16": "^1.1.0",
|
||||
"extract-text-webpack-plugin": "^3.0.1",
|
||||
"farmbot": "5.4.0-rc3",
|
||||
"farmbot": "5.4.0-rc4",
|
||||
"farmbot-toastr": "^1.0.3",
|
||||
"fastclick": "^1.0.6",
|
||||
"file-loader": "^1.1.5",
|
||||
|
|
|
@ -98,6 +98,7 @@ export function fakePlant(): TaggedPlantPointer {
|
|||
id: idCounter++,
|
||||
name: "Strawberry Plant 1",
|
||||
pointer_type: "Plant",
|
||||
plant_stage: "planned",
|
||||
x: 100,
|
||||
y: 200,
|
||||
z: 0,
|
||||
|
|
|
@ -128,7 +128,6 @@ const tr7: TaggedPoint = {
|
|||
"id": 1392,
|
||||
"created_at": "2017-05-24T20:41:19.804Z",
|
||||
"updated_at": "2017-05-24T20:41:19.804Z",
|
||||
// "device_id": 415,
|
||||
"meta": {
|
||||
|
||||
},
|
||||
|
@ -138,7 +137,8 @@ const tr7: TaggedPoint = {
|
|||
"x": 347,
|
||||
"y": 385,
|
||||
"z": 0,
|
||||
"openfarm_slug": "radish"
|
||||
"openfarm_slug": "radish",
|
||||
"plant_stage": "planned"
|
||||
},
|
||||
"uuid": "Point.1392.6"
|
||||
};
|
||||
|
@ -159,7 +159,8 @@ const tr8: TaggedPoint = {
|
|||
"x": 727,
|
||||
"y": 376,
|
||||
"z": 0,
|
||||
"openfarm_slug": "garlic"
|
||||
"openfarm_slug": "garlic",
|
||||
"plant_stage": "planned"
|
||||
},
|
||||
"uuid": "Point.1393.7"
|
||||
};
|
||||
|
@ -331,7 +332,7 @@ export let FAKE_RESOURCES: TaggedResource[] = [tr1, fakeDevice(), tr2, tr3, tr4,
|
|||
|
||||
export
|
||||
function buildResourceIndex(resources: TaggedResource[] = FAKE_RESOURCES,
|
||||
state = emptyState()) {
|
||||
state = emptyState()) {
|
||||
const KIND: keyof TaggedResource = "kind"; // Safety first, kids.
|
||||
return _(resources)
|
||||
.groupBy(KIND)
|
||||
|
|
|
@ -16,6 +16,7 @@ export function Plant(options: PlantOptions): PlantPointer {
|
|||
y: (options.y || 0),
|
||||
z: 0,
|
||||
radius: (options.radius || DEFAULT_PLANT_RADIUS),
|
||||
openfarm_slug
|
||||
openfarm_slug,
|
||||
plant_stage: "planned"
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { AuthState } from "./auth/interfaces";
|
||||
import { ConfigState } from "./config/interfaces";
|
||||
import { BotState } from "./devices/interfaces";
|
||||
import { Color as FarmBotJsColor, ALLOWED_MESSAGE_TYPES } from "farmbot";
|
||||
import { Color as FarmBotJsColor, ALLOWED_MESSAGE_TYPES, PlantStage } from "farmbot";
|
||||
import { DraggableState } from "./draggable/interfaces";
|
||||
import { PeripheralState } from "./controls/peripherals/interfaces";
|
||||
import { RestResources } from "./resources/interfaces";
|
||||
|
@ -108,7 +108,6 @@ interface BasePoint {
|
|||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
// device_id: number;
|
||||
pointer_id?: number | undefined;
|
||||
meta: { [key: string]: (string | undefined) };
|
||||
name: string;
|
||||
|
@ -118,6 +117,7 @@ export interface PlantPointer extends BasePoint {
|
|||
openfarm_slug: string;
|
||||
pointer_type: "Plant";
|
||||
planted_at?: string;
|
||||
plant_stage: PlantStage;
|
||||
}
|
||||
|
||||
export enum ToolPulloutDirection {
|
||||
|
|
|
@ -16,7 +16,8 @@ export function fakeResourceIndex(): ResourceIndex {
|
|||
"x": 1,
|
||||
"y": 2,
|
||||
"z": 3,
|
||||
"openfarm_slug": "garlic"
|
||||
"openfarm_slug": "garlic",
|
||||
"plant_stage": "planned"
|
||||
},
|
||||
"uuid": "plant"
|
||||
},
|
||||
|
|
|
@ -2258,9 +2258,9 @@ farmbot-toastr@^1.0.0, farmbot-toastr@^1.0.3:
|
|||
farmbot-toastr "^1.0.0"
|
||||
typescript "^2.3.4"
|
||||
|
||||
farmbot@5.4.0-rc3:
|
||||
version "5.4.0-rc3"
|
||||
resolved "https://registry.yarnpkg.com/farmbot/-/farmbot-5.4.0-rc3.tgz#5d3024f5234d7b22ebe77867cd1edb0e7e1d577e"
|
||||
farmbot@5.4.0-rc4:
|
||||
version "5.4.0-rc4"
|
||||
resolved "https://registry.yarnpkg.com/farmbot/-/farmbot-5.4.0-rc4.tgz#478275c12875afcbb8e88a970c449f8c911dce0a"
|
||||
dependencies:
|
||||
mqtt "2.15.0"
|
||||
typescript "^2.4.2"
|
||||
|
|
Loading…
Reference in New Issue