Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add belongs_to relationship to Execution for Workstep #27

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.4.1]

- Add `belongs_to` relationship to `Execution` for `Workstep`

## [0.4.0]

- Add new `Workstep` and `IntermediateProduct` resources.
Expand Down Expand Up @@ -75,7 +79,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add finishings specification
- Add jobs and parts specification

[Unreleased]: https://github.com/zaikio/zaikio-mission_control-ruby/compare/v0.4.0..HEAD
[Unreleased]: https://github.com/zaikio/zaikio-mission_control-ruby/compare/v0.4.1..HEAD
[0.4.1]: https://github.com/zaikio/zaikio-mission_control-ruby/compare/v0.4.0..v0.4.1
[0.4.0]: https://github.com/zaikio/zaikio-mission_control-ruby/compare/v0.3.0..v0.4.0
[0.3.0]: https://github.com/zaikio/zaikio-mission_control-ruby/compare/v0.2.12..v0.3.0
[0.2.12]: https://github.com/zaikio/zaikio-mission_control-ruby/compare/v0.2.11..v0.2.12
Expand Down
2 changes: 2 additions & 0 deletions lib/zaikio/mission_control/execution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class Execution < Base

attributes :id, :operator_id, :machine_id, :workstep_id, :quantity, :waste, :started_at, :ended_at, :phase,
:created_at, :updated_at

belongs_to :workstep, class_name: "Zaikio::MissionControl::Workstep"
end
end
end
2 changes: 1 addition & 1 deletion lib/zaikio/mission_control/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Zaikio
module MissionControl
VERSION = "0.4.0".freeze
VERSION = "0.4.1".freeze
end
end
217 changes: 217 additions & 0 deletions test/fixtures/vcr_cassettes/workstep_from_execution.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions test/zaikio/mission_control_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,17 @@ def token
end
end

test "fetch a workstep from an execution" do
VCR.use_cassette("workstep_from_execution") do
Zaikio::MissionControl.with_token(token) do
execution = Zaikio::MissionControl::Execution.find("7ff2e44e-2ab0-40ed-bc5f-2714edb8a0e0")
workstep = execution.workstep
assert_equal "cutting", workstep.kind
assert_equal 1, workstep.executions.count
end
end
end

test "fetch a production frame" do
VCR.use_cassette("production_frame") do
Zaikio::MissionControl.with_token(token) do
Expand Down