Rename supported to modelled.
This commit is contained in:
@@ -16,7 +16,7 @@ import { ModeledMethod } from "../../data-extensions-editor/modeled-method";
|
||||
import { MethodRow } from "./MethodRow";
|
||||
import { assertNever } from "../../pure/helpers-pure";
|
||||
import { vscode } from "../vscode-api";
|
||||
import { calculateSupportedPercentage } from "./supported";
|
||||
import { calculateModelledPercentage } from "./modelled";
|
||||
|
||||
export const DataExtensionsEditorContainer = styled.div`
|
||||
margin-top: 1rem;
|
||||
@@ -97,12 +97,12 @@ export function DataExtensionsEditor({
|
||||
};
|
||||
}, []);
|
||||
|
||||
const supportedPercentage = useMemo(
|
||||
() => calculateSupportedPercentage(externalApiUsages),
|
||||
const modelledPercentage = useMemo(
|
||||
() => calculateModelledPercentage(externalApiUsages),
|
||||
[externalApiUsages],
|
||||
);
|
||||
|
||||
const unsupportedPercentage = 100 - supportedPercentage;
|
||||
const unModelledPercentage = 100 - modelledPercentage;
|
||||
|
||||
const onChange = useCallback(
|
||||
(method: ExternalApiUsage, model: ModeledMethod) => {
|
||||
@@ -140,10 +140,10 @@ export function DataExtensionsEditor({
|
||||
{externalApiUsages.length > 0 && (
|
||||
<>
|
||||
<div>
|
||||
<h3>External API support stats</h3>
|
||||
<h3>External API model stats</h3>
|
||||
<ul>
|
||||
<li>Supported: {supportedPercentage.toFixed(2)}%</li>
|
||||
<li>Unsupported: {unsupportedPercentage.toFixed(2)}%</li>
|
||||
<li>Modelled: {modelledPercentage.toFixed(2)}%</li>
|
||||
<li>Unmodelled: {unModelledPercentage.toFixed(2)}%</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { calculateSupportedPercentage } from "../supported";
|
||||
import { calculateModelledPercentage } from "../modelled";
|
||||
|
||||
describe("calculateSupportedPercentage", () => {
|
||||
describe("calculateModelledPercentage", () => {
|
||||
it("when there are no external API usages", () => {
|
||||
expect(calculateSupportedPercentage([])).toBe(0);
|
||||
expect(calculateModelledPercentage([])).toBe(0);
|
||||
});
|
||||
|
||||
it("when there are is 1 supported external API usage", () => {
|
||||
it("when there are is 1 modelled external API usage", () => {
|
||||
expect(
|
||||
calculateSupportedPercentage([
|
||||
calculateModelledPercentage([
|
||||
{
|
||||
supported: true,
|
||||
},
|
||||
@@ -15,9 +15,9 @@ describe("calculateSupportedPercentage", () => {
|
||||
).toBe(100);
|
||||
});
|
||||
|
||||
it("when there are is 1 unsupported external API usage", () => {
|
||||
it("when there are is 1 unmodelled external API usage", () => {
|
||||
expect(
|
||||
calculateSupportedPercentage([
|
||||
calculateModelledPercentage([
|
||||
{
|
||||
supported: false,
|
||||
},
|
||||
@@ -25,9 +25,9 @@ describe("calculateSupportedPercentage", () => {
|
||||
).toBe(0);
|
||||
});
|
||||
|
||||
it("when there are multiple supporte and unsupported external API usage", () => {
|
||||
it("when there are multiple modelled and unmodelled external API usage", () => {
|
||||
expect(
|
||||
calculateSupportedPercentage([
|
||||
calculateModelledPercentage([
|
||||
{
|
||||
supported: false,
|
||||
},
|
||||
@@ -1,17 +1,17 @@
|
||||
import { ExternalApiUsage } from "../../data-extensions-editor/external-api-usage";
|
||||
|
||||
export function calculateSupportedPercentage(
|
||||
export function calculateModelledPercentage(
|
||||
externalApiUsages: Array<Pick<ExternalApiUsage, "supported">>,
|
||||
): number {
|
||||
if (externalApiUsages.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const supportedExternalApiUsages = externalApiUsages.filter(
|
||||
const modelledExternalApiUsages = externalApiUsages.filter(
|
||||
(m) => m.supported,
|
||||
);
|
||||
|
||||
const supportedRatio =
|
||||
supportedExternalApiUsages.length / externalApiUsages.length;
|
||||
return supportedRatio * 100;
|
||||
const modelledRatio =
|
||||
modelledExternalApiUsages.length / externalApiUsages.length;
|
||||
return modelledRatio * 100;
|
||||
}
|
||||
Reference in New Issue
Block a user