Skip to content

Commit

Permalink
update getCredits
Browse files Browse the repository at this point in the history
  • Loading branch information
Yinnii committed Jul 5, 2024
1 parent 6eecccf commit fcd3de8
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1701,8 +1701,9 @@ public Response getCreditsByUser(@QueryParam("email") String email, @QueryParam(
JSONObject acc = (JSONObject) p.parse(new String("{'account': { 'name': '" + user
+ "', 'homePage': '"+ service.xapiHomepage + "'}}"));

String verb = service.xapiUrl + "/definitions/mwb/verb/uploaded_task";
LrsCredentials res = service.getLrsCredentialsByCourse(courseId);
URL url = new URL(service.lrsURL + "/data/xAPI/statements?agent=" + acc.toString());
URL url = new URL(service.lrsURL + "/data/xAPI/statements?agent=" + acc.toString() + "&verb="+verb);
if(res==null){
return Response.ok().entity("problem").build();
}
Expand Down Expand Up @@ -1732,7 +1733,7 @@ public Response getCreditsByUser(@QueryParam("email") String email, @QueryParam(
for (Object index : statements) {
JSONObject jsonIndex = (JSONObject) index;
JSONObject actor = (JSONObject) jsonIndex.get("actor");
JSONObject verb = (JSONObject) jsonIndex.get("verb");
// JSONObject verb = (JSONObject) jsonIndex.get("verb");
JSONObject account = (JSONObject) actor.get("account");
if (account.get("name").toString().equals(user)
|| account.get("name").toString().equals(user)) {
Expand All @@ -1742,7 +1743,7 @@ public Response getCreditsByUser(@QueryParam("email") String email, @QueryParam(
// JSONObject definition = (JSONObject) object.get("definition");
JSONObject extensions = (JSONObject) context.get("extensions");// assignmentNumber
// check if its not a delete statement
if (extensions.get(service.xapiUrl + "/definitions/mwb/extensions/context/activity_data") != null && verb.get("id").toString().contains("uploaded_task")) {
if (extensions.get(service.xapiUrl + "/definitions/mwb/extensions/context/activity_data") != null) {
JSONObject fileDetails = (JSONObject) extensions
.get(service.xapiUrl + "/definitions/mwb/extensions/context/activity_data");
if (fileDetails.get("taskNr") != null) {
Expand Down

0 comments on commit fcd3de8

Please sign in to comment.