MCPcopy Index your code
hub / github.com/geekinglcq/CDCS / addCompe

Function addCompe

utility.py:24–48  ·  view source on GitHub ↗

Add a competition

()

Source from the content-addressed store, hash-verified

22
23
24def addCompe():
25 """
26 Add a competition
27 """
28 with codecs.open('competitions.json', 'r', encoding='utf-8') as f:
29 coms = json.load(f)
30 with codecs.open('solutions.json', 'r', encoding='utf-8') as f:
31 solutions = json.load(f)
32 cid = max([int(i) for i in solutions.keys()]) + 1
33 newCom = {}
34 for i in ["name", "link", "type", "platform", "hosts", "ddl"]:
35 newCom[i] = input("Enter %s: " % (i))
36 solution = []
37 num = input("How many solutins you find? ")
38 for i in range(int(num)):
39 rank = input("Rank: ")
40 print("The id of this solutions is %d" % (cid))
41 addSolutionInfo(cid)
42 solution.append({"rank": rank, "id": cid})
43 cid += 1
44
45 newCom["solutions"] = solution
46 coms.append(newCom)
47 with codecs.open("competitions.json", "w", encoding='utf-8') as f:
48 json.dump(coms, f, indent=4, ensure_ascii=False)
49
50
51def renderToMK():

Callers

nothing calls this directly

Calls 1

addSolutionInfoFunction · 0.85

Tested by

no test coverage detected