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) {
}'''})
res = post(url = url, headers = headers, data = data)
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):
headers = login_base_headers.copy()
......@@ -555,31 +556,31 @@ def _get_data_not_from_pack(eid, codecnt = None):
},
"query": '''
query codingExercise($eid: ID!, $codecnt: Int!) {
node(id: $eid) {
... on CodingExercise {
viewerStatus {
exerciseStatuses(last: $codecnt) {
nodes {
... on CodingExerciseStatus {
id
scoreRate
submission {
id
reports {
key
value
}
}
solution {
lang
asset { content }
}
}
}
node(id: $eid) {
... on CodingExercise {
viewerStatus {
exerciseStatuses(last: $codecnt) {
nodes {
... on CodingExerciseStatus {
id
scoreRate
submission {
id
reports {
key
value
}
}
solution {
lang
asset { content }
}
}
}
}
}
}
}
}'''})
res = post(url = url, headers = headers, data = data)
if not res: return False
......@@ -603,39 +604,39 @@ def _get_data_from_pack(eid, pid, codecnt = None):
},
"query": '''
query codingExercise($eid: ID!, $pid: ID, $codecnt: Int!) {
node(id: $pid) {
... on ExercisePack {
id
codingExercise(id: $eid) {
node(id: $pid) {
... on ExercisePack {
id
codingExercise(id: $eid) {
id
title
tags
viewerStatus {
passedCount
totalCount
exerciseStatuses(last: $codecnt) {
nodes {
... on CodingExerciseStatus {
id
title
tags
viewerStatus {
passedCount
totalCount
exerciseStatuses(last: $codecnt) {
nodes {
... on CodingExerciseStatus {
id
scoreRate
submission {
id
reports {
key
value
}
}
solution {
lang
asset { content }
}
}
}
}
scoreRate
submission {
id
reports {
key
value
}
}
solution {
lang
asset { content }
}
}
}
}
}
}
}
}
}'''})
res = post(url = url, headers = headers, data = data)
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