Skip to content

Commit

Permalink
Bugfix: GH-309 Update Parents after adding connection
Browse files Browse the repository at this point in the history
  • Loading branch information
cbadusch committed Jan 15, 2025
1 parent 3e6dccc commit 5cf36e8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion amd/build/app-lazy.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/build/app-lazy.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/src/app-lazy.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion vue3/components/flowchart/LearningPath.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ import ExpandNodeEdit from '../nodes/ExpandNodeEdit.vue'
import onNodeClick from '../../composables/flowHelper/onNodeClick'
import { debounce } from 'lodash';
import onWheel from '../../composables/flowHelper/onWheel'
import recalculateParentChild from '../../composables/recalculateParentChild'
// Load Store and Router
const store = useStore()
Expand Down Expand Up @@ -282,7 +283,7 @@ function onDragOver(event) {
}
// Adjust and add edges if connection was made
function handleConnect(params) {
async function handleConnect(params) {
if (params.source !== store.state.startnode) {
// Swap source and target positions
params.target = params.source;
Expand All @@ -291,6 +292,10 @@ if (params.source !== store.state.startnode) {
addEdges(addCustomEdge( params.target, params.source));
emit('add-edge', addCustomEdge( params.target, params.source));
props.learningpath.json.tree =
recalculateParentChild(props.learningpath.json.tree, 'parentCourse', 'childCourse', 'starting_node')
await store.dispatch('saveLearningpath', props.learningpath);
}
function handleSaveEdit(params){
Expand Down
10 changes: 5 additions & 5 deletions vue3/composables/conditions/addAutoRestrictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ function createRestriction (node_id, parent_node_id, store) {
{
"childCondition": [],
"data": {
"description": store.state.strings.course_description_condition_parent_node_completed,
"description_before": store.state.strings.course_restricition_before_condition_parent_node_completed,
"description": store.state.strings.course_description_condition_parent_courses,
"description_before": store.state.strings.course_restricition_before_condition_parent_courses,
"id": 150,
"label": "parent_node_completed",
"name": store.state.strings.course_name_condition_parent_node_completed,
"label": "parent_courses",
"name": store.state.strings.course_name_condition_parent_courses,
"node_id": 'condition_1',
"value": {
"node_id": parent_node_id
Expand All @@ -73,7 +73,7 @@ function createRestriction (node_id, parent_node_id, store) {
"data": {
"childCondition": 'condition_1',
"visibility": true,
"feedback_before": store.state.strings.course_restricition_before_condition_parent_node_completed,
"feedback_before": store.state.strings.course_restricition_before_condition_parent_courses,
"feedback_before_checkmark": true,
},
"draggable": false,
Expand Down

0 comments on commit 5cf36e8

Please sign in to comment.