Commit ba8cad61 authored by Zheng Yile's avatar Zheng Yile
Browse files

Modify codiaclient/network.py

parent 12b96534
...@@ -458,7 +458,8 @@ mutation startSession($pid: ID!, $code: String) { ...@@ -458,7 +458,8 @@ mutation startSession($pid: ID!, $code: String) {
}'''}) }'''})
res = post(url = url, headers = headers, data = data) res = post(url = url, headers = headers, data = data)
if not res: return False if not res: return False
return json.loads(res.text)['data']['startSession'] try: return json.loads(res.text)['data']['startSession']
except: return False
def _login(username, passwd): def _login(username, passwd):
headers = login_base_headers.copy() headers = login_base_headers.copy()
...@@ -555,31 +556,31 @@ def _get_data_not_from_pack(eid, codecnt = None): ...@@ -555,31 +556,31 @@ def _get_data_not_from_pack(eid, codecnt = None):
}, },
"query": ''' "query": '''
query codingExercise($eid: ID!, $codecnt: Int!) { query codingExercise($eid: ID!, $codecnt: Int!) {
node(id: $eid) { node(id: $eid) {
... on CodingExercise { ... on CodingExercise {
viewerStatus { viewerStatus {
exerciseStatuses(last: $codecnt) { exerciseStatuses(last: $codecnt) {
nodes { nodes {
... on CodingExerciseStatus { ... on CodingExerciseStatus {
id id
scoreRate scoreRate
submission { submission {
id id
reports { reports {
key key
value value
}
}
solution {
lang
asset { content }
}
}
}
} }
}
solution {
lang
asset { content }
}
} }
}
} }
}
} }
}
}'''}) }'''})
res = post(url = url, headers = headers, data = data) res = post(url = url, headers = headers, data = data)
if not res: return False if not res: return False
...@@ -603,39 +604,39 @@ def _get_data_from_pack(eid, pid, codecnt = None): ...@@ -603,39 +604,39 @@ def _get_data_from_pack(eid, pid, codecnt = None):
}, },
"query": ''' "query": '''
query codingExercise($eid: ID!, $pid: ID, $codecnt: Int!) { query codingExercise($eid: ID!, $pid: ID, $codecnt: Int!) {
node(id: $pid) { node(id: $pid) {
... on ExercisePack { ... on ExercisePack {
id id
codingExercise(id: $eid) { codingExercise(id: $eid) {
id
title
tags
viewerStatus {
passedCount
totalCount
exerciseStatuses(last: $codecnt) {
nodes {
... on CodingExerciseStatus {
id id
title scoreRate
tags submission {
viewerStatus { id
passedCount reports {
totalCount key
exerciseStatuses(last: $codecnt) { value
nodes { }
... on CodingExerciseStatus { }
id solution {
scoreRate lang
submission { asset { content }
id
reports {
key
value
}
}
solution {
lang
asset { content }
}
}
}
}
} }
}
} }
}
} }
}
} }
}
}'''}) }'''})
res = post(url = url, headers = headers, data = data) res = post(url = url, headers = headers, data = data)
if not res: return False if not res: return False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment