Handle non-contributor cases correctly, remove obsolete bugs

This commit is contained in:
Pieter Vander Vennet 2023-01-15 22:30:33 +01:00
parent 0f3296bf2c
commit 3046fbfb56

View file

@ -79,7 +79,6 @@ class SingleUserSettingsPanel extends EditableTagRendering {
this.SetClass("rounded-xl") this.SetClass("rounded-xl")
userInfoFocusedQuestion.addCallbackAndRun((selected) => { userInfoFocusedQuestion.addCallbackAndRun((selected) => {
if (config.id !== selected) { if (config.id !== selected) {
console.log("Removing the glowingshadow...")
self.RemoveClass("glowing-shadow") self.RemoveClass("glowing-shadow")
} else { } else {
self.SetClass("glowing-shadow") self.SetClass("glowing-shadow")
@ -122,7 +121,6 @@ class UserInformationMainPanel extends VariableUiElement {
let result = new Function("feat", "return " + code + ";")({ let result = new Function("feat", "return " + code + ";")({
properties: amendedPrefs.data, properties: amendedPrefs.data,
}) })
console.warn("Calculation for", name, "yielded", result)
if (result !== undefined && result !== "" && result !== null) { if (result !== undefined && result !== "" && result !== null) {
if (typeof result !== "string") { if (typeof result !== "string") {
result = JSON.stringify(result) result = JSON.stringify(result)
@ -145,15 +143,18 @@ class UserInformationMainPanel extends VariableUiElement {
return replaced === simplifiedName return replaced === simplifiedName
} }
) )
amendedPrefs.data["_translation_contributions"] = "" + isTranslator.commits if(isTranslator){
amendedPrefs.data["_translation_contributions"] = "" + isTranslator.commits
}
const isCodeContributor = codeContributors.contributors.find( const isCodeContributor = codeContributors.contributors.find(
(c: { contributor: string; commits: number }) => { (c: { contributor: string; commits: number }) => {
const replaced = c.contributor.toLowerCase().replace(/\s+/g, "") const replaced = c.contributor.toLowerCase().replace(/\s+/g, "")
return replaced === simplifiedName return replaced === simplifiedName
} }
) )
amendedPrefs.data["_code_contributions"] = "" + isCodeContributor.commits if(isCodeContributor){
amendedPrefs.data["_code_contributions"] = "" + isCodeContributor.commits
}
amendedPrefs.ping() amendedPrefs.ping()
}) })