Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotfix] BE param #74

Merged
merged 2 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/images/professor-ubuntu/server/getAssignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
dir_path_student+"/"+assignment_id).encode('ascii')).decode('ascii') # base64 encode
urlmodel = json.loads(requests.get(
Urls.base_url+"/url/"+user["id"]).text)
url = urlmodel["apiEndpoint"]+"/files/" + encoded_dir_path_student
url = urlmodel["api_endpoint"]+"/files/" + encoded_dir_path_student
json_str = requests.get(url).text
# json to dict
result = json.loads(json.loads(json_str))
Expand Down
10 changes: 10 additions & 0 deletions resources/images/professor-ubuntu/server/getValueAndTime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

start=`date +%s.%N`

/usr/bin/python3 $1 > values.txt

finish=`date +%s.%N`
diff=$( echo "$finish - $start" | bc -l )

echo $diff > time.txt
12 changes: 11 additions & 1 deletion resources/images/professor-ubuntu/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def create_directories(assignment_id, data_users_assigned):
dir_path_student+"/"+assignment_id).encode('ascii')).decode('ascii') # base64 encode
urlmodel = json.loads(requests.get(
Urls.base_url+"/url/"+user["id"]).text)
url = urlmodel["apiEndpoint"]+"/mkdir/" + encoded_dir_path_student
url = urlmodel["api_endpoint"]+"/mkdir/" + encoded_dir_path_student
result = requests.post(url).text
if result == False:
print("Error in mkdir, uid:"+user["id"])
Expand Down Expand Up @@ -72,12 +72,22 @@ async def create_assignment(assignment_info: Dto.AssignmentModel = None):
async def get_assignment(id: str, assignment_id: str):
dir_path_professor = Urls.dir_path_professor
dir_path = "%s/%s/%s" % (dir_path_professor, assignment_id, id)
curr_path = os.path.dirname(os.path.realpath(__file__))
file_list = os.listdir(dir_path)
return_dict = {}
for file in file_list:
f = open(dir_path+"/"+file, "r")
content = f.read()
return_dict["content"] = content
f.close()
os.system('/bin/bash %s/getValueAndTime.sh' % curr_path)
f = open("%s/values.txt" % curr_path, "r")
values = f.read()
return_dict["values"] = values
f.close()
f = open("%s/time.txt" % curr_path, "r")
time = f.read()
return_dict["time"] = time
f.close()

return json.dumps(return_dict)
Loading