forked from indymedia/epicyon
Setting skill level to zero removes it
parent
065daedba9
commit
bc67385587
|
@ -88,6 +88,7 @@ def setProfileImage(baseDir: str,httpPrefix :str,nickname: str,domain: str, \
|
||||||
def setSkillLevel(baseDir: str,nickname: str,domain: str, \
|
def setSkillLevel(baseDir: str,nickname: str,domain: str, \
|
||||||
skill: str,skillLevelPercent: int) -> bool:
|
skill: str,skillLevelPercent: int) -> bool:
|
||||||
"""Set a skill level for a person
|
"""Set a skill level for a person
|
||||||
|
Setting skill level to zero removes it
|
||||||
"""
|
"""
|
||||||
if skillLevelPercent<0 or skillLevelPercent>100:
|
if skillLevelPercent<0 or skillLevelPercent>100:
|
||||||
return False
|
return False
|
||||||
|
@ -96,7 +97,10 @@ def setSkillLevel(baseDir: str,nickname: str,domain: str, \
|
||||||
return False
|
return False
|
||||||
with open(actorFilename, 'r') as fp:
|
with open(actorFilename, 'r') as fp:
|
||||||
actorJson=commentjson.load(fp)
|
actorJson=commentjson.load(fp)
|
||||||
actorJson['skills'][skill]=skillLevelPercent
|
if skillLevelPercent>0:
|
||||||
|
actorJson['skills'][skill]=skillLevelPercent
|
||||||
|
else:
|
||||||
|
del actorJson['skills'][skill]
|
||||||
with open(actorFilename, 'w') as fp:
|
with open(actorFilename, 'w') as fp:
|
||||||
commentjson.dump(actorJson, fp, indent=4, sort_keys=False)
|
commentjson.dump(actorJson, fp, indent=4, sort_keys=False)
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue