mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 03:37:28 +01:00
Fix incorrect difference detected due to order of tags
This commit is contained in:
parent
9738a8a826
commit
84d379d490
@ -590,10 +590,10 @@ class Package(db.Model):
|
|||||||
"video_url": self.video_url,
|
"video_url": self.video_url,
|
||||||
"donate_url": self.donate_url_actual,
|
"donate_url": self.donate_url_actual,
|
||||||
|
|
||||||
"tags": [x.name for x in self.tags],
|
"tags": sorted([x.name for x in self.tags]),
|
||||||
"content_warnings": [x.name for x in self.content_warnings],
|
"content_warnings": sorted([x.name for x in self.content_warnings]),
|
||||||
|
|
||||||
"provides": [x.name for x in self.provides],
|
"provides": sorted([x.name for x in self.provides]),
|
||||||
"thumbnail": (base_url + tnurl) if tnurl is not None else None,
|
"thumbnail": (base_url + tnurl) if tnurl is not None else None,
|
||||||
"screenshots": [base_url + ss.url for ss in self.screenshots],
|
"screenshots": [base_url + ss.url for ss in self.screenshots],
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ from typing import Dict
|
|||||||
|
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
|
import deep_compare
|
||||||
|
|
||||||
from .flask import *
|
from .flask import *
|
||||||
from .models import *
|
from .models import *
|
||||||
from .user import *
|
from .user import *
|
||||||
@ -73,7 +75,7 @@ def has_blocked_domains(text: str, username: str, location: str) -> bool:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def diff_dictionaries(one: Dict, two: Dict):
|
def diff_dictionaries(one: Dict, two: Dict) -> List:
|
||||||
if len(set(one.keys()).difference(set(two.keys()))) != 0:
|
if len(set(one.keys()).difference(set(two.keys()))) != 0:
|
||||||
raise "Mismatching keys"
|
raise "Mismatching keys"
|
||||||
|
|
||||||
@ -82,14 +84,14 @@ def diff_dictionaries(one: Dict, two: Dict):
|
|||||||
for key, before in one.items():
|
for key, before in one.items():
|
||||||
after = two[key]
|
after = two[key]
|
||||||
|
|
||||||
if before is dict:
|
if isinstance(before, dict):
|
||||||
diff = diff_dictionaries(before, after)
|
diff = diff_dictionaries(before, after)
|
||||||
if len(diff) != 0:
|
if len(diff) != 0:
|
||||||
retval.append({
|
retval.append({
|
||||||
"key": key,
|
"key": key,
|
||||||
"changes": diff,
|
"changes": diff,
|
||||||
})
|
})
|
||||||
elif before != after:
|
elif not deep_compare.CompareVariables.compare(before, after):
|
||||||
retval.append({
|
retval.append({
|
||||||
"key": key,
|
"key": key,
|
||||||
"before": before,
|
"before": before,
|
||||||
|
@ -16,6 +16,7 @@ click-plugins==1.1.1
|
|||||||
click-repl==0.2.0
|
click-repl==0.2.0
|
||||||
coverage==7.2.3
|
coverage==7.2.3
|
||||||
decorator==5.1.1
|
decorator==5.1.1
|
||||||
|
deep-compare==1.0.5
|
||||||
dnspython==2.3.0
|
dnspython==2.3.0
|
||||||
email-validator==2.0.0.post1
|
email-validator==2.0.0.post1
|
||||||
exceptiongroup==1.1.1
|
exceptiongroup==1.1.1
|
||||||
|
@ -46,3 +46,5 @@ alembic
|
|||||||
|
|
||||||
validators
|
validators
|
||||||
gitdb
|
gitdb
|
||||||
|
|
||||||
|
deep-compare
|
||||||
|
Loading…
Reference in New Issue
Block a user