Skip to content

Commit

Permalink
Add belongs_to relationship to Execution for Workstep (#27)
Browse files Browse the repository at this point in the history
* Add `belongs_to` relationship to `Execution` for `Workstep`

* Update CHANGELOG.md

Co-authored-by: Jalyna <js@zaikio.com>

---------

Co-authored-by: Jalyna <js@zaikio.com>
  • Loading branch information
srozen and jalyna authored Nov 8, 2023
1 parent 4f92edb commit 539d460
Show file tree
Hide file tree
Showing 5 changed files with 237 additions and 2 deletions.
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

0 comments on commit 539d460

Please sign in to comment.