From d6e25687a5928288e29ff1ab0b73db9ce356e035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Mon, 12 Oct 2020 16:45:26 +0200 Subject: [PATCH 1/2] Fix excitationTypes enum shift --- static/js/data.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/static/js/data.js b/static/js/data.js index b40346a9..75c8af74 100644 --- a/static/js/data.js +++ b/static/js/data.js @@ -1,13 +1,13 @@ class excitationTypes { - static get Valence() { return new excitationType(1 << 1, new description("Valence")) } - static get Rydberg() { return new excitationType(1 << 2, new description("Rydberg")) } - static get PiPis() { return new excitationType(1 << 3, new description(String.raw`\pi \rightarrow \pi^\star`, true)) } - static get nPis() { return new excitationType(1 << 4, new description(String.raw`n \rightarrow \pi^\star`, true)) } - static get Single() { return new excitationType(1 << 5, new description("Single")) } - static get Double() { return new excitationType(1 << 6, new description("Double")) } - static get SingletSinglet() { return new excitationType(1 << 7, new description(String.raw`\mathrm{Singlet} \rightarrow \mathrm{Singlet}`, true)) } - static get SingletTriplet() { return new excitationType(1 << 8, new description(String.raw`\mathrm{Singlet} \rightarrow \mathrm{Triplet}`, true)) } - static get DoubletDoublet() { return new excitationType(1 << 9, new description(String.raw`\mathrm{Doublet} \rightarrow \mathrm{Doublet}`, true)) } + static get Valence() { return new excitationType(1, new description("Valence")) } + static get Rydberg() { return new excitationType(1 << 1, new description("Rydberg")) } + static get PiPis() { return new excitationType(1 << 2, new description(String.raw`\pi \rightarrow \pi^\star`, true)) } + static get nPis() { return new excitationType(1 << 3, new description(String.raw`n \rightarrow \pi^\star`, true)) } + static get Single() { return new excitationType(1 << 4, new description("Single")) } + static get Double() { return new excitationType(1 << 5, new description("Double")) } + static get SingletSinglet() { return new excitationType(1 << 6, new description(String.raw`\mathrm{Singlet} \rightarrow \mathrm{Singlet}`, true)) } + static get SingletTriplet() { return new excitationType(1 << 7, new description(String.raw`\mathrm{Singlet} \rightarrow \mathrm{Triplet}`, true)) } + static get DoubletDoublet() { return new excitationType(1 << 8, new description(String.raw`\mathrm{Doublet} \rightarrow \mathrm{Doublet}`, true)) } // Max bit shifts is 31 because int are int32 So 1 << 31 are -2147483648 static get Others() { return new excitationType(1 << 31, new description("Others")) } static get All() { return EnumUltils.getAll(this, excitationType) } From 0ff21cc962aea64eafc1ea215292e7af8dd5433c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Mon, 12 Oct 2020 16:49:35 +0200 Subject: [PATCH 2/2] Fix EnumUltils.GetFlags --- static/js/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/data.js b/static/js/data.js index 75c8af74..280fdfb6 100644 --- a/static/js/data.js +++ b/static/js/data.js @@ -28,7 +28,7 @@ class EnumUltils { return lst } static GetFlags(value, enumClass, valueType) { - return this.getAll(enumClass, valueType).filter((x) => { value & x[1] }) + return this.getAll(enumClass, valueType).filter(x => value & x[1]) } }