-
Notifications
You must be signed in to change notification settings - Fork 594
fix: base progress calculation depending on the implementation groups… #3305
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
base: main
Are you sure you want to change the base?
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@backend/core/serializers.py`:
- Line 1846: The progress calculation is reading the raw
obj.selected_implementation_groups while the serialized
selected_implementation_groups uses its getter, causing inconsistencies; update
get_progress(self, obj) to use the serializer's getter (e.g., call
self.get_selected_implementation_groups(obj) or the same method used to populate
the selected_implementation_groups SerializerMethodField) instead of
obj.selected_implementation_groups so both the serialized groups and progress
respect the framework's implementation_groups_definition.
| source="get_selected_implementation_groups" | ||
| ) | ||
| progress = serializers.ReadOnlyField() | ||
| progress = serializers.SerializerMethodField() |
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.
🧩 Analysis chain
🏁 Script executed:
# First, let's look at the specific lines in the serializer
head -n 1900 backend/core/serializers.py | tail -n 60Repository: intuitem/ciso-assistant-community
Length of output: 2179
🏁 Script executed:
# Find and inspect the ComplianceAssessment model methods
rg -n "def get_selected_implementation_groups|def get_progress|def get_requirement_assessments" backend/core/models.py -A 5Repository: intuitem/ciso-assistant-community
Length of output: 968
🏁 Script executed:
# Check how selected_implementation_groups is used in the model
rg -n "selected_implementation_groups" backend/core/models.py -B 2 -A 2Repository: intuitem/ciso-assistant-community
Length of output: 4822
Selected implementation groups may not align with progress calculation.
The serialized selected_implementation_groups field uses the getter, which returns [] when the framework lacks implementation_groups_definition. However, get_progress() checks the raw obj.selected_implementation_groups field directly, bypassing that same framework-level check.
This creates a divergence: if the raw field is populated but the framework definition is missing, the progress calculation filters requirements using the raw field while the API exposes an empty groups list. The progress value becomes inconsistent with the selected groups shown to the client.
Use the getter consistently in get_progress() to ensure both the serialized field and progress calculation respect the framework's implementation groups definition:
🔧 Proposed adjustment
def get_progress(self, obj):
- if obj.selected_implementation_groups:
- return obj.get_progress()
- if hasattr(obj, "progress"):
- return obj.progress
- return obj.get_progress()
+ selected_groups = obj.get_selected_implementation_groups()
+ if selected_groups:
+ return obj.get_progress()
+ return obj.get_progress()🤖 Prompt for AI Agents
In `@backend/core/serializers.py` at line 1846, The progress calculation is
reading the raw obj.selected_implementation_groups while the serialized
selected_implementation_groups uses its getter, causing inconsistencies; update
get_progress(self, obj) to use the serializer's getter (e.g., call
self.get_selected_implementation_groups(obj) or the same method used to populate
the selected_implementation_groups SerializerMethodField) instead of
obj.selected_implementation_groups so both the serialized groups and progress
respect the framework's implementation_groups_definition.
|
I have read the CLA Document and I hereby sign the CLA |
e7d6b6e to
ed7349b
Compare
base progress calculation depending on the implementation groups of the audit
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.