Skip to content

Commit

Permalink
Fix requires_study_review display in CDSAWorkspace table
Browse files Browse the repository at this point in the history
  • Loading branch information
amstilp committed Mar 21, 2024
1 parent 5498162 commit 670b01a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 6 additions & 6 deletions primed/cdsa/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class CDSAWorkspaceStaffTable(tables.Table):
verbose_name="DUO modifiers",
linkify_item=True,
)
cdsaworkspace_requires_study_review = BooleanIconColumn(
cdsaworkspace__requires_study_review = BooleanIconColumn(
verbose_name="Study review required?",
orderable=False,
true_icon="dash-circle-fill",
Expand All @@ -333,12 +333,12 @@ class Meta:
"cdsaworkspace__study",
"cdsaworkspace__data_use_permission__abbreviation",
"cdsaworkspace__data_use_modifiers",
"cdsaworkspace_requires_study_review",
"cdsaworkspace__requires_study_review",
"cdsaworkspace__gsr_restricted",
)
order_by = ("name",)

def render_requires_study_review(self, record):
def render_cdsaworkspace__requires_study_review(self, record):
try:
if record.cdsaworkspace.get_primary_cdsa().requires_study_review:
icon = "dash-circle-fill"
Expand All @@ -364,7 +364,7 @@ class CDSAWorkspaceUserTable(tables.Table):
transform=lambda x: x.abbreviation,
verbose_name="DUO modifiers",
)
cdsaworkspace_requires_study_review = BooleanIconColumn(
cdsaworkspace__requires_study_review = BooleanIconColumn(
verbose_name="Study review required?",
orderable=False,
true_icon="dash-circle-fill",
Expand All @@ -381,12 +381,12 @@ class Meta:
"cdsaworkspace__study",
"cdsaworkspace__data_use_permission__abbreviation",
"cdsaworkspace__data_use_modifiers",
"cdsaworkspace_requires_study_review",
"cdsaworkspace__requires_study_review",
"cdsaworkspace__gsr_restricted",
)
order_by = ("name",)

def render_requires_study_review(self, record):
def render_cdsaworkspace__requires_study_review(self, record):
try:
if record.cdsaworkspace.get_primary_cdsa().requires_study_review:
icon = "dash-circle-fill"
Expand Down
14 changes: 8 additions & 6 deletions primed/cdsa/tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def test_render_requires_study_review(self):
cdsa_workspace = factories.CDSAWorkspaceFactory.create()
self.assertIn(
"question-circle-fill",
table.render_requires_study_review(cdsa_workspace.workspace),
table.render_cdsaworkspace__requires_study_review(cdsa_workspace.workspace),
)
# With a primary - no review required.
agreement = factories.DataAffiliateAgreementFactory.create(
Expand All @@ -487,14 +487,15 @@ def test_render_requires_study_review(self):
study=cdsa_workspace.study,
)
self.assertEqual(
"", table.render_requires_study_review(cdsa_workspace.workspace)
"",
table.render_cdsaworkspace__requires_study_review(cdsa_workspace.workspace),
)
# With a primary - review required.
agreement.requires_study_review = True
agreement.save()
self.assertIn(
"dash-circle-fill",
table.render_requires_study_review(cdsa_workspace.workspace),
table.render_cdsaworkspace__requires_study_review(cdsa_workspace.workspace),
)


Expand Down Expand Up @@ -533,7 +534,7 @@ def test_render_requires_study_review(self):
cdsa_workspace = factories.CDSAWorkspaceFactory.create()
self.assertIn(
"question-circle-fill",
table.render_requires_study_review(cdsa_workspace.workspace),
table.render_cdsaworkspace__requires_study_review(cdsa_workspace.workspace),
)
# With a primary - no review required.
agreement = factories.DataAffiliateAgreementFactory.create(
Expand All @@ -542,12 +543,13 @@ def test_render_requires_study_review(self):
study=cdsa_workspace.study,
)
self.assertEqual(
"", table.render_requires_study_review(cdsa_workspace.workspace)
"",
table.render_cdsaworkspace__requires_study_review(cdsa_workspace.workspace),
)
# With a primary - review required.
agreement.requires_study_review = True
agreement.save()
self.assertIn(
"dash-circle-fill",
table.render_requires_study_review(cdsa_workspace.workspace),
table.render_cdsaworkspace__requires_study_review(cdsa_workspace.workspace),
)

0 comments on commit 670b01a

Please sign in to comment.