Skip to content

Commit 829c31a

Browse files
jannisbornNinaWie
andauthored
Deploy version 1.16 + all locations update (#356)
* feat: location merging script * data: merge/update files * chore * add package resolved file * refactor: chart dependency --------- Co-authored-by: NinaWie <[email protected]>
1 parent 31702a7 commit 829c31a

File tree

5 files changed

+69212
-57979
lines changed

5 files changed

+69212
-57979
lines changed

PennyMe.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
8319D8D027414AC100E97D93 /* ZoomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8319D8CF27414AC100E97D93 /* ZoomViewController.swift */; };
1111
837476502CADDAD800812146 /* StatisticsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8374764F2CADDAD800812146 /* StatisticsViewController.swift */; };
1212
837476532CB0918000812146 /* DGCharts in Frameworks */ = {isa = PBXBuildFile; productRef = 837476522CB0918000812146 /* DGCharts */; };
13-
837476552CB0918000812146 /* DGChartsDynamic in Frameworks */ = {isa = PBXBuildFile; productRef = 837476542CB0918000812146 /* DGChartsDynamic */; };
1413
839CF440267B78AB00E259D9 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 839CF43F267B78AB00E259D9 /* SettingsViewController.swift */; };
1514
83BAF44E2A792D45002365D2 /* ImagePickerHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83BAF44D2A792D45002365D2 /* ImagePickerHelper.swift */; };
1615
83D226CD2620F4910050ED9E /* PinViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83D226CC2620F4910050ED9E /* PinViewController.swift */; };
@@ -84,7 +83,6 @@
8483
isa = PBXFrameworksBuildPhase;
8584
buildActionMask = 2147483647;
8685
files = (
87-
837476552CB0918000812146 /* DGChartsDynamic in Frameworks */,
8886
837476532CB0918000812146 /* DGCharts in Frameworks */,
8987
);
9088
runOnlyForDeploymentPostprocessing = 0;
@@ -197,7 +195,6 @@
197195
name = PennyMe;
198196
packageProductDependencies = (
199197
837476522CB0918000812146 /* DGCharts */,
200-
837476542CB0918000812146 /* DGChartsDynamic */,
201198
);
202199
productName = PennyMe;
203200
productReference = 9F9F31A12300B40900C0E854 /* PennyMe.app */;
@@ -688,11 +685,6 @@
688685
package = 837476512CB0918000812146 /* XCRemoteSwiftPackageReference "Charts" */;
689686
productName = DGCharts;
690687
};
691-
837476542CB0918000812146 /* DGChartsDynamic */ = {
692-
isa = XCSwiftPackageProductDependency;
693-
package = 837476512CB0918000812146 /* XCRemoteSwiftPackageReference "Charts" */;
694-
productName = DGChartsDynamic;
695-
};
696688
/* End XCSwiftPackageProductDependency section */
697689
};
698690
rootObject = 9F9F31992300B40900C0E854 /* Project object */;

PennyMe.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/scripts/merge_jsons.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import json
2+
from copy import deepcopy
3+
from datetime import datetime
4+
from pathlib import Path
5+
6+
import typer
7+
8+
app = typer.Typer()
9+
10+
11+
@app.command()
12+
def merge_locations(all_file: Path):
13+
with open(all_file, "r") as f:
14+
alll = json.load(f)
15+
server_file = all_file.parent / all_file.name.replace("all", "server")
16+
with open(server_file, "r") as f:
17+
ser = json.load(f)
18+
19+
ls, la = len(ser["features"]), len(alll["features"])
20+
print(f"All locations has {la} entries, server locations {ls}")
21+
22+
youngest_all = sorted(
23+
[
24+
datetime.strptime(e["properties"]["last_updated"], "%Y-%m-%d")
25+
for e in alll["features"]
26+
]
27+
)[-1]
28+
print(f"Youngest entry in all locations is of {youngest_all}")
29+
30+
# Merge entries. Start from server locations, otherwise we have to overwrite
31+
new_all = deepcopy(ser)
32+
new_all_ids = [e["properties"]["id"] for e in ser["features"]]
33+
34+
for allentry in alll["features"][::-1]:
35+
if allentry["properties"]["id"] not in new_all_ids:
36+
new_all["features"].insert(0, allentry)
37+
38+
print(f"New all locations has {len(new_all['features'])} entries")
39+
40+
# Delete entries from server locations that are older than youngest in all locations
41+
42+
new_server = deepcopy(ser)
43+
new_server["features"] = []
44+
45+
for e in ser["features"]:
46+
if (
47+
datetime.strptime(e["properties"]["last_updated"], "%Y-%m-%d")
48+
< youngest_all
49+
):
50+
continue
51+
new_server["features"].append(e)
52+
53+
print(f"New server location has length {len(new_server['features'])}")
54+
55+
with open(all_file.parent / all_file.name.replace(".json", "_new.json"), "w") as f:
56+
json.dump(new_all, f, indent=4, ensure_ascii=False)
57+
58+
with open(
59+
server_file.parent / server_file.name.replace(".json", "_new.json"), "w"
60+
) as f:
61+
json.dump(new_server, f, indent=4, ensure_ascii=False)
62+
63+
print("Saved data!")
64+
65+
66+
if __name__ == "__main__":
67+
app()

0 commit comments

Comments
 (0)