Skip to content

Commit

Permalink
refactor: add intention in the actions
Browse files Browse the repository at this point in the history
  • Loading branch information
yan-elena committed May 7, 2024
1 parent 31e4af1 commit 8dce606
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import {Level} from "../../../../model/Level";
function ExecutedDeed(props) {

const deed = props.event.message.event.deedInfo
const intention = props.event.message.event.intentionInfo.value
const type = "Executed deed"
let description = "Deed " + deed.term + " executed"
let info = "Type: " + deed.type
const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && e.message.event.goalInfo.intention.value && props.event.message.event.intentionInfo.value && e.message.event.goalInfo.intention.value.id === props.event.message.event.intentionInfo.value.id)
const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && intention && e.message.event.goalInfo.goalFunctor === intention.trigger)
const info = "Type: " + deed.type + (intention ? ", Intention: " + intention.id + " " + intention.trigger : "")

return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import {Level} from "../../../../model/Level";

function ExternalActionFinished(props) {
const deed = props.event.message.event.deedInfo
const intention = props.event.message.event.intentionInfo.value
const type = "External Action Finished"
let description = "External action " + deed.term + " executed"
let info = "Type: external " + deed.type
const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && e.message.event.goalInfo.intention.value && e.message.event.goalInfo.intention.value.id === props.event.message.event.intentionInfo.value.id)
const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && intention && e.message.event.goalInfo.goalFunctor === intention.trigger)
const info = "Type: external " + deed.type + (intention ? ", Intention: " + intention.id + " " + intention.trigger : "")

return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {Level} from "../../../../model/Level";
function ExternalActionTriggered(props) {
const deed = props.event.message.event.action
const type = "External Action Triggered"
const intention = props.event.message.event.intentionInfo.value
let description = "External action " + deed.term + " triggered"
let info = "Type: external action"
const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && e.message.event.goalInfo.intention.value && e.message.event.goalInfo.intention.value.id === props.event.message.event.action.intention.id)
const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && intention && e.message.event.goalInfo.goalFunctor === intention.trigger)
const info = "Type: external action" + (intention ? ", Intention: " + intention.id + " " + intention.trigger : "")

return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {Level} from "../../../../model/Level";
function InternalActionFinished(props) {
const type = "Internal Action Finished"
const action = props.event.message.event.deedInfo
const intention = props.event.message.event.intentionInfo.value
let description = "Internal action " + action.term + " finished"
let info = "Type: " + action.type
let explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && e.message.event.goalInfo.intention.value && props.event.message.event.intentionInfo.value && e.message.event.goalInfo.intention.value.id === props.event.message.event.intentionInfo.value.id)
const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && intention && e.message.event.goalInfo.goalFunctor === intention.trigger)
const info = "Type: " + action.type + (intention ? ", Intention: " + intention.id + " " + intention.trigger : "")

return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function IntentionCreated(props) {

const im = props.event.message.event.intentionInfo.intendedMeansInfo
const unifier = im[0].unifier
const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && e.message.event.goalInfo.intention.value && e.message.event.goalInfo.intention.value.id === props.event.message.event.intentionInfo.id)
const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && e.message.event.goalInfo.goalFunctor === props.event.message.event.intentionInfo.trigger)

if (props.event.message.event.intentionInfo.state === "undefined") {
return (
Expand Down

0 comments on commit 8dce606

Please sign in to comment.