Skip to content

Commit

Permalink
Fixing test failure/error and tidying up legal entity overview for no…
Browse files Browse the repository at this point in the history
… data

#CTCTOWALTZ-2626
#6368
  • Loading branch information
jessica-woodland-scott-db committed Jan 16, 2023
1 parent 41bafa0 commit 471f849
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public void findAssessmentRatingPermissions() {
String differentRoleName = mkName(stem, "differentRoleName");

long schemeId = ratingSchemeHelper.createEmptyRatingScheme(mkName(stem, "assessment permission checker"));
ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", 'R');
ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", 'A');
ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", 'G');
ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", "R");
ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", "A");
ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", "G");
long defnId = assessmentHelper.createDefinition(schemeId, mkName(stem, "assessment permission checker"), adminRoleName, AssessmentVisibility.PRIMARY, null);

assertThrows(
Expand Down Expand Up @@ -168,9 +168,9 @@ public void findAssessmentRatingPermissionsNullGroupId() {
String adminRoleName = mkName(stem, "adminRoleName");

long schemeId = ratingSchemeHelper.createEmptyRatingScheme(mkName(stem, "assessment permission checker"));
ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", 'R');
ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", 'A');
ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", 'G');
ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", "R");
ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", "A");
ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", "G");
long defnId = assessmentHelper.createDefinition(schemeId, mkName(stem, "assessment permission checker"), adminRoleName, AssessmentVisibility.PRIMARY, null);

PermissionGroupRecord pg = permissionHelper.createGroup(stem);
Expand Down Expand Up @@ -201,9 +201,9 @@ public void findAssessmentRatingPermissionsNullPermittedRole() {
String adminRoleName = mkName(stem, "adminRoleName");

long schemeId = ratingSchemeHelper.createEmptyRatingScheme(mkName(stem, "assessment permission checker"));
ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", 'R');
ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", 'A');
ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", 'G');
ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", "R");
ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", "A");
ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", "G");
long defnId = assessmentHelper.createDefinition(schemeId, mkName(stem, "assessment permission checker"), null, AssessmentVisibility.PRIMARY, null);

AssessmentDefinitionRatingOperations nullPermittedRoleGivesAllPermissions = assessmentRatingPermissionChecker.getRatingPermissions(appA, defnId, u1);
Expand All @@ -223,9 +223,9 @@ public void findAssessmentRatingPermissionsReadOnlyDefinition() {
EntityReference appA = appHelper.createNewApp(mkName(stem, "appA"), ouIds.a);

long schemeId = ratingSchemeHelper.createEmptyRatingScheme(mkName(stem, "assessment permission checker"));
ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", 'R');
ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", 'A');
ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", 'G');
ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", "R");
ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", "A");
ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", "G");
long defnId = assessmentHelper.createDefinition(schemeId, mkName(stem, "assessment permission checker"), null, AssessmentVisibility.PRIMARY, null);
assessmentHelper.updateDefinitionReadOnly(defnId);

Expand All @@ -246,9 +246,9 @@ public void findAssessmentRatingPermissionsReadOnlyRating() {
EntityReference appA = appHelper.createNewApp(mkName(stem, "appA"), ouIds.a);

long schemeId = ratingSchemeHelper.createEmptyRatingScheme(mkName(stem, "assessment permission checker"));
Long r1 = ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", 'R');
Long r2 = ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", 'A');
Long r3 = ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", 'G');
Long r1 = ratingSchemeHelper.saveRatingItem(schemeId, "Disinvest", 1, "red", "R");
Long r2 = ratingSchemeHelper.saveRatingItem(schemeId, "Maintain", 2, "amber", "A");
Long r3 = ratingSchemeHelper.saveRatingItem(schemeId, "Invest", 3, "green", "G");
long defnId = assessmentHelper.createDefinition(schemeId, mkName(stem, "assessment permission checker"), null, AssessmentVisibility.PRIMARY, null);
assessmentHelper.createAssessment(defnId, appA, r1);
assessmentHelper.updateRatingReadOnly(appA, defnId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public static void main(String[] args) throws ParseException {

long schemeId = ratingSchemeHelper.createEmptyRatingScheme("Test Scheme");

Long y = ratingSchemeHelper.saveRatingItem(schemeId, "Yes", 10, "green", 'Y');
Long n = ratingSchemeHelper.saveRatingItem(schemeId, "No", 20, "red", 'N');
Long m = ratingSchemeHelper.saveRatingItem(schemeId, "Maybe", 30, "yellow", 'M');
Long y = ratingSchemeHelper.saveRatingItem(schemeId, "Yes", 10, "green", "Y");
Long n = ratingSchemeHelper.saveRatingItem(schemeId, "No", 20, "red", "N");
Long m = ratingSchemeHelper.saveRatingItem(schemeId, "Maybe", 30, "yellow", "M");

long defA = assessmentHelper.createDefinition(schemeId, "Test Definition A", null, AssessmentVisibility.PRIMARY, "Edit Favourites");
long defB = assessmentHelper.createDefinition(schemeId, "Test Definition B", null, AssessmentVisibility.SECONDARY, "Edit Favourites");
Expand Down
69 changes: 38 additions & 31 deletions waltz-ng/client/legal-entity/pages/view/LegalEntityOverview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import ViewLink from "../../../common/svelte/ViewLink.svelte";
import {legalEntityStore} from "../../../svelte-stores/legal-entity-store";
import {entity} from "../../../common/services/enums/entity";
import NoData from "../../../common/svelte/NoData.svelte";
export let primaryEntityReference;
Expand All @@ -17,13 +18,11 @@
$: legalEntity = $legalEntityCall?.data;
$: console.log({primaryEntityReference, legalEntity});
</script>
<PageHeader icon={entity.LEGAL_ENTITY.icon}
name={legalEntity?.name}>
name={legalEntity?.name || "Unknown"}>
<div slot="breadcrumbs">
<ol class="waltz-breadcrumbs">
<li>
Expand All @@ -33,7 +32,7 @@
Legal Entity
</li>
<li>
<span>{legalEntity?.name}</span>
<span>{legalEntity?.name || "Unknown"}</span>
</li>
</ol>
</div>
Expand All @@ -43,37 +42,45 @@
<div class="waltz-page-summary waltz-page-summary-attach"
style="margin-bottom: 5em;">
<div class="waltz-display-section">
<div class="row">
<div class="col-sm-2">
Name
</div>
<div class="col-sm-10">
{legalEntity?.name}
</div>
</div>
<div class="row">
<div class="col-sm-2">
Description
</div>
<div class="col-sm-10">
{legalEntity?.description || "-"}
{#if legalEntity}
<div class="row">
<div class="col-sm-2">
Name
</div>
<div class="col-sm-10">
{legalEntity?.name}
</div>
</div>
</div>
<div class="row">
<div class="col-sm-2">
External Id
<div class="row">
<div class="col-sm-2">
Description
</div>
<div class="col-sm-10">
{legalEntity?.description || "-"}
</div>
</div>
<div class="col-sm-10">
{legalEntity?.externalId || "-"}
<div class="row">
<div class="col-sm-2">
External Id
</div>
<div class="col-sm-10">
{legalEntity?.externalId || "-"}
</div>
</div>
</div>
<div class="row">
<div class="col-sm-2">
Provenance
<div class="row">
<div class="col-sm-2">
Provenance
</div>
<div class="col-sm-10">
{legalEntity?.provenance}
</div>
</div>
<div class="col-sm-10">
{legalEntity?.provenance}
{:else}
<div class="row">
<div class="col-sm-12">
<NoData>No legal entity found</NoData>
</div>
</div>
</div>
{/if}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ function controller($q, serviceBroker) {
};

vm.determineViewState = (surveyInstance) => {
return surveyInstance.status === 'COMPLETED' || surveyInstance.status === 'APPROVED'
? 'main.survey.instance.response.view'
: 'main.survey.instance.response.edit';
return surveyInstance.status === "COMPLETED" || surveyInstance.status === "APPROVED"
? "main.survey.instance.response.view"
: "main.survey.instance.response.edit";
};

vm.$onChanges = () => {
Expand All @@ -93,26 +93,26 @@ function controller($q, serviceBroker) {
CORE_API.SurveyTemplateStore.findAll,
[]);

if (vm.parentEntityRef.kind === 'PERSON') {
if (vm.parentEntityRef.kind === "PERSON") {
runsPromise = serviceBroker.loadViewData(
CORE_API.SurveyRunStore.findForRecipientId,
[vm.parentEntityRef.id],
{ force: true });
{force: true});

instancesPromise = serviceBroker.loadViewData(
CORE_API.SurveyInstanceStore.findForRecipientId,
[vm.parentEntityRef.id],
{ force: true });
{force: true});
} else {
runsPromise = serviceBroker.loadViewData(
CORE_API.SurveyRunStore.findByEntityReference,
[vm.parentEntityRef],
{ force: true });
CORE_API.SurveyRunStore.findByEntityReference,
[vm.parentEntityRef],
{force: true});

instancesPromise = serviceBroker.loadViewData(
CORE_API.SurveyInstanceStore.findByEntityReference,
[vm.parentEntityRef],
{ force: true });
CORE_API.SurveyInstanceStore.findByEntityReference,
[vm.parentEntityRef],
{force: true});
}

vm.visibility.showSurveySubject = ! isSurveyTargetKind(vm.parentEntityRef.kind);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public long createEmptyRatingScheme(String name) {
}


public Long saveRatingItem(long schemeId, String name, int position, String color, Character code) {
public Long saveRatingItem(long schemeId, String name, int position, String color, String code) {
ImmutableRatingSchemeItem rating = ImmutableRatingSchemeItem.builder()
.name(name)
.description(format("%s description", name))
Expand Down

0 comments on commit 471f849

Please sign in to comment.