-
Notifications
You must be signed in to change notification settings - Fork 0
470 fix connector overlap #472
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
Conversation
… bridging Co-authored-by: dwarwick <15970276+dwarwick@users.noreply.github.com>
… to improve routing Co-authored-by: dwarwick <15970276+dwarwick@users.noreply.github.com>
…idging Co-authored-by: dwarwick <15970276+dwarwick@users.noreply.github.com>
…overlap Co-authored-by: dwarwick <15970276+dwarwick@users.noreply.github.com>
…orthogonal behavior Co-authored-by: dwarwick <15970276+dwarwick@users.noreply.github.com>
…erlap Co-authored-by: dwarwick <15970276+dwarwick@users.noreply.github.com>
… orthogonal routing Co-authored-by: dwarwick <15970276+dwarwick@users.noreply.github.com>
Co-authored-by: dwarwick <15970276+dwarwick@users.noreply.github.com>
Updated the `Content` property of `ShapeAnnotation` to allow a longer truncated text, increasing the maximum length from 50 to 300 characters. This ensures more of the question text is displayed in the diagram annotations. Added a blank line before the creation of the `optionNode` object to improve code readability. This change does not affect functionality.
Restructure survey diagram to use NodeGroup for improved connector routing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive survey branching feature for the SurveyShark application, allowing survey creators to organize questions into groups and define conditional logic based on user responses. The implementation includes database schema changes, new API endpoints, a professional UI for configuring branching, and foundational survey-taking logic.
Key Changes:
- New database table
QuestionGroupswith branching configuration - Complete CRUD API for question group management
- Professional accordion-based UI for configuring survey branching
- Foundation for one-question-at-a-time survey display with branching logic
- Comprehensive test coverage with new bUnit test file
Reviewed Changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| bUnitTests/SurveyTests.cs | New comprehensive test suite for Survey component with 954 lines covering initialization, authentication, service interactions, test data structures, component structure, error handling, data loading, preview/view modes, branching logic, question answer initialization, question properties, and CAPTCHA tests |
| SURVEY_BRANCHING_README.md | Comprehensive documentation covering implementation overview, completed features, remaining work, usage instructions, architecture notes, and testing checklist |
| JwtIdentity/wwwroot/css/app.css | Added group color CSS variables and styles for visual branching indicators |
| JwtIdentity/wwwroot/css/app-light.css | Added light mode group color variables |
| JwtIdentity/wwwroot/css/app-dark.css | Added dark mode group color variables |
| JwtIdentity/Models/Survey.cs | Added QuestionGroups collection property |
| JwtIdentity/Models/QuestionGroup.cs | New model for question group data |
| JwtIdentity/Models/Question.cs | Added GroupId property and True/False branching fields |
| JwtIdentity/Models/ChoiceOption.cs | Added BranchToGroupId for conditional branching |
| JwtIdentity/Migrations/*.cs | Database migrations for branching schema |
| JwtIdentity/Data/ApplicationDbContext.cs | Added QuestionGroups DbSet |
| JwtIdentity/Controllers/SurveyController.cs | Updated to include question groups and added unpublish endpoint |
| JwtIdentity/Controllers/QuestionGroupController.cs | New controller with full CRUD operations |
| JwtIdentity/Controllers/QuestionController.cs | Added UpdateGroup and UpdateTrueFalseBranching endpoints |
| JwtIdentity/Controllers/ChoiceOptionController.cs | Added UpdateChoiceOption endpoint |
| JwtIdentity/Controllers/AnswerController.cs | Added survey published validation and QuestionGroups loading |
| JwtIdentity/Configurations/MapperConfig.cs | Added QuestionGroup mapping |
| JwtIdentity.Tests/ControllerTests/QuestionControllerTests.cs | Added tests for True/False branching |
| JwtIdentity.PlaywrightTests/*.cs | Updated tests for new UI menu structure |
| JwtIdentity.Common/ViewModels/*.cs | Added QuestionGroupViewModel and updated existing ViewModels |
| JwtIdentity.Common/Helpers/ApiEndpoints.cs | Added QuestionGroup endpoint |
| JwtIdentity.Client/Pages/Survey/*.razor | Major updates to Survey and new BranchingSurveyEdit component |
| JwtIdentity.Client/Pages/Survey/*.razor.cs | Implemented branching navigation logic |
| JwtIdentity.Client/JwtIdentity.Client.csproj | Updated Syncfusion version and added InternalsVisibleTo |
| IMPLEMENTATION_SUMMARY.md | Detailed summary of implementation status |
| Dockerfile | Removed file |
| BRANCHING_IMPLEMENTATION_STATUS.md | Technical implementation details |
| AGENTS.md | Updated with MudCheckBox API guidance |
Comments suppressed due to low confidence (12)
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:1
- The magic number calculation
question.Id * 1000 + 1andquestion.Id * 1000 + 2for generating unique option IDs is fragile. If a question has an ID larger than the maximum int divided by 1000, this could overflow. Consider using a different approach like generating GUIDs or using a Tuple that doesn't require an integer ID for display purposes.
using Syncfusion.Blazor.Diagram;
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:199
- This foreach loop implicitly filters its target sequence - consider filtering the sequence explicitly using '.Where(...)'.
foreach (var option in mcQuestion.Options)
{
if (option.BranchToGroupId == group.GroupNumber)
{
branchingRulesUsingGroup.Add($"Q{question.QuestionNumber}: {question.Text} - Option: {option.OptionText}");
}
}
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:213
- This foreach loop implicitly filters its target sequence - consider filtering the sequence explicitly using '.Where(...)'.
foreach (var option in saQuestion.Options)
{
if (option.BranchToGroupId == group.GroupNumber)
{
branchingRulesUsingGroup.Add($"Q{question.QuestionNumber}: {question.Text} - Option: {option.OptionText}");
}
}
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:672
- Variable option.BranchToGroupId may be null at this access because it has a nullable type.
result.Add((option.OptionText, option.BranchToGroupId.Value, option.Id));
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:683
- Variable option.BranchToGroupId may be null at this access because it has a nullable type.
result.Add((option.OptionText, option.BranchToGroupId.Value, option.Id));
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:137
- Generic catch clause.
catch (Exception ex)
{
Logger?.LogError(ex, "Error loading survey branching data");
_ = Snackbar.Add("Error loading survey data", Severity.Error);
}
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:175
- Generic catch clause.
catch (Exception ex)
{
Logger?.LogError(ex, "Error adding question group");
_ = Snackbar.Add("Error creating question group", Severity.Error);
}
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:300
- Generic catch clause.
catch (Exception ex)
{
Logger?.LogError(ex, "Error deleting question group");
_ = Snackbar.Add("Error deleting question group", Severity.Error);
}
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:329
- Generic catch clause.
catch (Exception ex)
{
Logger?.LogError(ex, "Error updating question group");
_ = Snackbar.Add("Error updating group", Severity.Error);
}
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:366
- Generic catch clause.
catch (Exception ex)
{
Logger?.LogError(ex, "Error moving question to group");
_ = Snackbar.Add("Error moving question", Severity.Error);
// Reload data to ensure consistency
await LoadData();
}
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:388
- Generic catch clause.
catch (Exception ex)
{
Logger?.LogError(ex, "Error updating choice option branch");
_ = Snackbar.Add("Error updating branching", Severity.Error);
}
JwtIdentity.Client/Pages/Survey/BranchingSurveyEdit.razor.cs:427
- Generic catch clause.
catch (Exception ex)
{
Logger?.LogError(ex, "Error updating True/False branching");
_ = Snackbar.Add("Error updating branching", Severity.Error);
}
No description provided.