Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve code quality in chart factory classes (#6931)
* Improve code quality in chart factory classes Refactor and improve code quality in `citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/chartfactory/impl` classes without changing behavior. * **Add Utility Classes:** - Add `ChartUtils` class for common chart creation methods. - Add `DateUtils` class for common date formatting and parsing methods. * **Refactor Chart Creation:** - Replace redundant code for creating charts and setting properties with calls to `ChartUtils.createChart` in `AbstractChartDataManagerImpl`, `AbstractGhantChartManagerImpl`, `AdminChartDataManagerImpl`, `BallotChartDataManagerImpl`, and `ChartDataManagerImpl`. * **Refactor Date Formatting and Parsing:** - Replace duplicated date formatting and parsing logic with calls to `DateUtils.formatDate` and `DateUtils.parseDate` in `AdminChartDataManagerImpl`, `AbstractGhantChartManagerImpl`, and `BallotChartDataManagerImpl`. * **Improve Variable Names:** - Improve variable names for better readability and maintainability in `AbstractChartDataManagerImpl`, `AbstractGhantChartManagerImpl`, `AdminChartDataManagerImpl`, and `BallotChartDataManagerImpl`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Hack23/cia?shareId=XXXX-XXXX-XXXX-XXXX). * * Refactor `GovernmentOutcomeChartDataManagerImpl` to improve readability and maintainability * **Variable Renaming** - Rename `map` to `outcomeMap` - Rename `dataSeries` to `chartDataSeries` - Rename `series` to `chartSeries` - Rename `content` to `layout` * **Method Updates** - Update `createPeriodData` method to use new variable names - Update `createGovernmentOutcomeChart` method to use new variable names * Improve variable names for better readability and maintainability * Rename variable `t` to `roleMember` in `getStepMapping` method * Rename variable `t` to `roleMember` in `RoleMapping` class * Replace redundant code for creating charts and setting properties with calls to `ChartUtils.createChart` * Remove unused imports and constants * Replace duplicated date formatting logic with calls to `DateUtils.formatDate` * Improve variable names for better readability and maintainability * Update method `addPartyData` to use `DateUtils.formatDate` for date formatting * Update method `addBallotData` to use `DateUtils.formatDate` for date formatting * Update method `createPartyBallotChart` to use `ChartUtils.addChart` for adding charts to layout * Update method `createPartyWinnerChart` to use `ChartUtils.addChart` for adding charts to layout * Refactor `PartyCoalationChartDataManagerImpl.java` to use `ChartUtils` and improve variable names * **ChartUtils Integration** - Replace redundant code for creating charts and setting properties with calls to `ChartUtils.addChart` * **Variable Names** - Improve variable names for better readability and maintainability - Rename `content` to `layout` - Rename `map` to `partySummaryMap` - Rename `series` to `chartSeries` - Rename `dataSeries` to `chartDataSeries` * Update `PartyDocumentChartDataManagerImpl` to use `DateUtils` and improve variable names * **Remove redundant code:** - Remove `SimpleDateFormat` and `DD_MMM_YYYY` constant * **Use `DateUtils`:** - Replace date formatting logic with `DateUtils.formatDate` * **Improve variable names:** - Rename `entry` to `documentTypeEntry` - Rename `org` to `partyShortCode` - Rename `map` to `documentTypeMap` - Rename `content` to `layout` * Refactor `PartyGhantChartManagerImpl.java` to improve variable names * Replace variable `t` with `roleMember` for better readability * Update method parameters and references to use `roleMember` instead of `t` * * Replace redundant code for creating charts and setting properties with calls to `ChartUtils.addChart` * Improve variable names for better readability and maintainability - Rename `content` to `layout` - Rename `list` to `partySummaries` - Rename `map` to `partySummaryMap` * Replace redundant code for creating charts and setting properties with calls to `ChartUtils.createChart` and `DateUtils.formatDate` * Remove `SimpleDateFormat` and `DD_MMM_YYYY` constant * Replace date formatting logic with `DateUtils.formatDate` * Replace `content` parameter with `layout` in `createPersonDocumentHistoryChart` method * Improve variable names for better readability and maintainability * * Replace redundant code for creating charts and setting properties with calls to `ChartUtils.createChart` * Replace duplicated date formatting and parsing logic with calls to `DateUtils.formatDate` * Remove unused imports and constants * Improve variable names for better readability and maintainability * fix compilation and cleanup
- Loading branch information