Skip to content

fix: Updated code to use 'putAll' method in assessment & activity aggregate APIs#647

Open
aimansharief wants to merge 6 commits intoSunbird-Lern:developfrom
aimansharief:aggregate-api-fixes
Open

fix: Updated code to use 'putAll' method in assessment & activity aggregate APIs#647
aimansharief wants to merge 6 commits intoSunbird-Lern:developfrom
aimansharief:aggregate-api-fixes

Conversation

@aimansharief
Copy link
Contributor

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Type of change

Please choose appropriate options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes in the below checkboxes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Ran Test A
  • Ran Test B

Test Configuration:

  • Software versions: Java-11, play2-2.7.2, scala-2.11, redis-5.0.3
  • Hardware versions: 2 CPU / 4GB RAM

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link

Copilot AI left a 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 introduces Cassandra update variants that use putAll for map columns (to merge keys rather than replacing the full map), and wires those new operations into the activity/assessment aggregators so map updates preserve existing entries.

Changes:

  • Added CassandraUtil.createUpdateQueryWithPutAll to generate UPDATE statements that use putAll for map-typed values.
  • Extended CassandraOperation + CassandraOperationImpl with updateRecordWithPutAll and batchUpdateWithPutAll.
  • Switched assessment/activity aggregation flows to use the new putAll-based update paths.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
core/sunbird-cassandra-utils/src/main/java/org/sunbird/common/CassandraUtil.java Adds an UPDATE builder that uses putAll for map values to support merge semantics.
core/sunbird-cassandra-utils/src/main/java/org/sunbird/cassandraimpl/CassandraOperationImpl.java Implements new update/batch-update entry points that delegate to the new QueryBuilder logic.
core/sunbird-cassandra-utils/src/main/java/org/sunbird/cassandra/CassandraOperation.java Exposes new *WithPutAll APIs to callers.
assessment-aggregator/src/main/scala/org/sunbird/assessment/service/CassandraService.scala Uses updateRecordWithPutAll when updating user activity aggregates.
assessment-aggregator/src/main/scala/org/sunbird/assessment/actor/AssessmentAggregatorActor.scala Refactors actor wiring/dispatch and uses concrete service instantiation (not injectable).
assessment-aggregator/src/test/scala/org/sunbird/assessment/actor/AssessmentAggregatorActorSpec.scala Updates actor construction (currently mismatched with existing mock-based test expectations).
activity-aggregator/src/main/scala/org/sunbird/activity/actor/ActivityAggregatorActor.scala Switches activity aggregate batch updates to batchUpdateWithPutAll.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aimansharief aimansharief changed the title fix: Use putAll updates for Cassandra map columns fix: Updated code to use 'putAll' method in assessment & activity aggregate APIs Feb 16, 2026
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
27.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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