mirror of https://gitlab.com/bashrc2/epicyon
Set location on role
parent
3dc34bd77d
commit
a9740565ca
19
person.py
19
person.py
|
|
@ -619,14 +619,27 @@ def personUpgradeActor(baseDir: str, personJson: {},
|
||||||
{
|
{
|
||||||
'@type': 'Occupation',
|
'@type': 'Occupation',
|
||||||
'name': occupationName,
|
'name': occupationName,
|
||||||
"location": {
|
'location': {
|
||||||
"@type": "VirtualLocation",
|
'@type': 'VirtualLocation',
|
||||||
"url": personDomain
|
'url': personDomain
|
||||||
},
|
},
|
||||||
'skills': []
|
'skills': []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
updateActor = True
|
updateActor = True
|
||||||
|
else:
|
||||||
|
# add location if it is missing
|
||||||
|
for index in range(len(personJson['hasOccupation'])):
|
||||||
|
ocItem = personJson['hasOccupation'][index]
|
||||||
|
if ocItem.get('hasOccupation'):
|
||||||
|
ocItem = ocItem['hasOccupation']
|
||||||
|
if not ocItem.get('location'):
|
||||||
|
personDomain = personJson['id'].split('/users/')[0]
|
||||||
|
ocItem['location'] = {
|
||||||
|
"@type": "VirtualLocation",
|
||||||
|
"url": personDomain
|
||||||
|
}
|
||||||
|
updateActor = True
|
||||||
|
|
||||||
# if no roles are defined then ensure that the admin
|
# if no roles are defined then ensure that the admin
|
||||||
# roles are configured
|
# roles are configured
|
||||||
|
|
|
||||||
5
roles.py
5
roles.py
|
|
@ -140,11 +140,16 @@ def _setActorRole(actorJson: {}, roleName: str) -> bool:
|
||||||
if occupationItem['hasOccupation']['name'] == roleName:
|
if occupationItem['hasOccupation']['name'] == roleName:
|
||||||
return True
|
return True
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
|
actorDomain = actorJson['id'].split('/users/')[0]
|
||||||
newRole = {
|
newRole = {
|
||||||
"@type": "Role",
|
"@type": "Role",
|
||||||
"hasOccupation": {
|
"hasOccupation": {
|
||||||
"@type": "Occupation",
|
"@type": "Occupation",
|
||||||
"name": roleName,
|
"name": roleName,
|
||||||
|
'location': {
|
||||||
|
'@type': 'VirtualLocation',
|
||||||
|
'url': actorDomain
|
||||||
|
},
|
||||||
"occupationalCategory": {
|
"occupationalCategory": {
|
||||||
"@type": "CategoryCode",
|
"@type": "CategoryCode",
|
||||||
"inCodeSet": {
|
"inCodeSet": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue