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

More convenient output of Relationship calculator. #475

Merged
merged 1 commit into from
Jul 3, 2023

Conversation

se-sss
Copy link
Contributor

@se-sss se-sss commented Jun 30, 2023

Assume user selected 2 persons:
Person 1
Person 2

Now order of output is more natural:
Person1 is somebody for PersonA, PersonA is somebody for personB, PersonB is somebody for Person2.

Assume user selected 2 persons:
Person 1
Person 2

Now order of output is more natural:
Person1 is somebody for PersonA, PersonA is somebody  for personB, PersonB is somebody for Person2.
@se-sss
Copy link
Contributor Author

se-sss commented Jun 30, 2023

Was:
image

Now convenient straight order:
image

@se-sss
Copy link
Contributor Author

se-sss commented Jun 30, 2023

Difference in choice fields is due to old version used (2.22) for the 1st screenshot.

@Serg-Norseman
Copy link
Owner

I can't accept this PR any time soon, because there is a branch feature/compex-kinship, where I worked on the issue of strengthening the some kinships analysis. Improvements in this branch intersect with yours, the code will become completely incompatible for automatic merging.

@Serg-Norseman
Copy link
Owner

But it's a cool improvement idea.

@se-sss
Copy link
Contributor Author

se-sss commented Jul 1, 2023

Also I have proposal of adding "Swap" button to that window to see backward route.
Code working but not prepared for commit yet.

Copy link
Owner

@Serg-Norseman Serg-Norseman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Serg-Norseman Serg-Norseman merged commit df9625d into Serg-Norseman:master Jul 3, 2023
@se-sss
Copy link
Contributor Author

se-sss commented Jul 3, 2023

Something got broken.
Initial selection is not correct
image

After swap seems to be correct:
image

@se-sss
Copy link
Contributor Author

se-sss commented Jul 3, 2023

I shall look later

@se-sss
Copy link
Contributor Author

se-sss commented Jul 3, 2023

Withou my pull request
image

@Serg-Norseman
Copy link
Owner

Приведите здесь без PR ваш код для свопа. Я у себя протестировал - в дереве отношения выводятся корректно, в этом модуле - тоже. Есть подозрение, что нужно посмотреть на реализацию свопа. Если вы есть в телеграмме - можете выйти на меня через канал программы и скинуть код в личку напрямую.

@Serg-Norseman
Copy link
Owner

Для быстрого прототипа я сделал следующее в RelationshipCalculatorDlg:

        public RelationshipCalculatorDlg(IBaseWindow baseWin)
        {
            ....
            fController.SetRec2(null);
            this.KeyDown += RelationshipCalculatorDlg_KeyDown;
        }

        private void RelationshipCalculatorDlg_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == System.Windows.Forms.Keys.F11) {
                fController.Swap();
            }
        }

И в RelationshipCalculatorDlgController:

        public void Swap()
        {
            var rec1 = fRec1;
            var rec2 = fRec2;
            fRec1 = rec2;
            fRec2 = rec1;
            Solve();
        }

На выбранном примере в своём дереве - всё работает корректно.

@se-sss
Copy link
Contributor Author

se-sss commented Jul 3, 2023

А проблема не со свапом. Первая картинка, где правнуком назван, получена без его применения.
А после свапа - похоже на правду.
Это после Merge branch 'master' into feature/complex-kinship

@se-sss
Copy link
Contributor Author

se-sss commented Jul 3, 2023

Есть мой прадед, у него сестра, у неё есть муж.
Почему-то пишется, что я внук этого мужа сестры.
В обратную нормально.

@Serg-Norseman
Copy link
Owner

А в прежнем варианте тоже было неправильно? Или так стало после моих последних изменений?

@Serg-Norseman
Copy link
Owner

Есть предположение, в чем может быть дело. У меня набор правил для определения родственных связей не обратно совместим (не помню подходящий термин). Т.е. когда идет обход цепочки графа в одном направлении - нужные связи отрабатываются правильно, а в обратном направлении, срабатывает какое-то неправильное правило, вместо отсутствующего.

@Serg-Norseman
Copy link
Owner

Странно: нашел у себя в точности описанный паттерн, прогнал тест - в обоих направлениях всё определяется правильно.

@se-sss
Copy link
Contributor Author

se-sss commented Jul 4, 2023

Brother_in_law неожиданно появляется
image

@se-sss
Copy link
Contributor Author

se-sss commented Jul 4, 2023

Комментирование правила под этим индексом помогает
//RegisterKinship(
// RelationSet.Create(),
// RelationSet.Create(RelationKind.rkWifeFather, RelationKind.rkWifeMother),
// RelationSet.Create(RelationKind.rkSon),
// RelationKind.rkBrotherInLaw_W, 0, 0);

@Serg-Norseman
Copy link
Owner

Я подумаю как улучшить отладку модуля. Первоочередные моменты: нужно сделать какой-либо вывод всей анализируемой цепочки узлов графа, и вывод последовательности входных и выходных типов отношений на каждой итерации. Вышеуказанная ошибка может происходить только из-за некачественного определения какой-то связи. Не обязательо это BrotherInLaw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants