studip / studip-rest.ip

DEPRECATED // An alternative, RESTful approach to web services for Stud.IP implementing OAuth
http://studip.github.com/studip-rest.ip
GNU General Public License v2.0
19 stars 7 forks source link

Topic related document folders do not show up in /documents/:course_id/folder #130

Closed mschuwalow closed 7 years ago

mschuwalow commented 7 years ago

Folders created as "topic related document folder" do not show up in /documents/:course_id/folder. Additionally there doesn't seem to be a way to get from a course to its topic related folders.

tleilax commented 7 years ago

I am unable to reproduce this. The following part of the query should be responsible for this and seems to work fine in my tests:

https://github.com/studip/studip-rest.ip/blob/master/routes/documents.php#L204-L209

Maybe the permissions are set to 0?

mschuwalow commented 7 years ago

I am only aware of one course where this problem arises. I'll try to describe is in more detail.

In the following course: screenshot from 2017-05-03 10-40-46

Sending a GET against either the course itself (https://studip.uos.de/plugins.php/restipplugin/api/documents/6e210f47d8aa3c186a7e59e1322f4aa9/folder) or any of its subfolders (e.g. https://studip.uos.de/plugins.php/restipplugin/api/documents/6e210f47d8aa3c186a7e59e1322f4aa9/folder/5Bc31c114da7973069381a2522bb32c1b2) returns a 400 with "Range 6e210f47d8aa3c186a7e59e1322f4aa9 has no documents" as the response text.

Sending a GET request against any of documents themselves works as expected. (e.g. https://studip.uos.de/plugins.php/restipplugin/api/documents/a24b0053556c75edfe0e67e394653c40 returns a valid document)

From looking into the source it looks like https://github.com/studip/studip-rest.ip/blob/master/routes/documents.php#L154-L161 fails for this particular case. I am unsure whether I'm just misunderstanding how this type of folder is supposed to work or this is indeed a bug.

tleilax commented 7 years ago

Hm, this seems odd indeed. Is there any chance that you could provide the actual db data for this course (SELECT * FROM seminare WHERE Seminar_id = '6e210f47d8aa3c186a7e59e1322f4aa9')?

I'll look into this as soon as I can.

tleilax commented 7 years ago

Oh, the json response of the course route should be sufficient as well. The modules are listed there too.

mschuwalow commented 7 years ago

Sure. Here you go:

{
  "course": {
    "course_id": "6e210f47d8aa3c186a7e59e1322f4aa9",
    "start_time": "1490997600",
    "chdate": "1489663172",
    "duration_time": "0",
    "number": "8.3320",
    "title": "Ensemble Methods for Machine Learning",
    "subtitle": null,
    "type": "1",
    "modules": {
      "overview": true,
      "admin": true,
      "forum": true,
      "documents": true,
      "schedule": true,
      "participants": true,
      "personal": false,
      "literature": false,
      "wiki": true,
      "scm": true,
      "elearning_interface": false,
      "documents_folder_permissions": true,
      "calendar": false,
      "resources": false
    },
    "description": "The course “Ensemble Methods for Machine Learning” is intended for bachelor and master students who are interested in a more detailed and practical introduction to ensemble methods. \r\n\r\nThe first part of the course will cover basic concepts for regression, classification and density estimation. We will start with simple models (called “weak learners”) and then continue with their compositions into more complex models (e.g. perceptrons and decision trees) and conclude with their aggregation into ensembles (e.g. random decision forests). \r\nConcepts discussed in more detail in this part include bootstrapping & boosting, random ferns & forests and extra randomized trees. The theoretical sessions will be accompanied by practical examples (in python).  There is no mandatory homework, however, after the first part, there will be a pass/fail midterm test that is a prerequisite for participation in the second part.\r\n\r\nThe second part of the course will cover applications of random forests to classification, regression and density estimation problems. We will present some examples for analysis of low and high dimensional data from the fields of computer vision, time-series analysis and others. Students will work on smaller projects in groups. At the end of the course, each group will present their work and hand in a project report (due 1st of August).\r\nThe final grade will be the average of the grades of the presentation and the group report.",
    "location": "",
    "visitdate": "1493799956",
    "status": "autor",
    "visible": "1",
    "semester_id": "b2b8652acc0f6caac5569bc27c3777b5",
    "teachers": [
      "67cc3e0fc4abf1dc74fad929e8ad6f24",
      "61949291470a25263b8008dec8577ebf"
    ],
    "tutors": [],
    "students": [
      "8fb08efda4d8c4573ac8838dd54392a5",
      "faf919abf28bf2d60b5f17765ef8fcb8",
      "191dd9ba35394b4ece6a13677ccab7ad",
      "2ab2bf094c3237b62fc444c06ae248b7",
      "8c1165719a5ffe25f70f69da04c6d468",
      "3c297e1ccd3827dbf18f2ae9f43bfe73",
      "24448b6b46cef747f18294981a7cfcec",
      "f39593f7521ad1e091f6a9e87f22c1b0",
      "4659ab0402f98533fdc88b5827a94cab",
      "a10c0c2b63ac145632a4d234e97ffe05",
      "cc6d16dbf9feb038a5a99e00f0454280",
      "bfe888b74f681374ea5b315b9530d58f",
      "6b106ccee727f53800d68b0bea8aba89",
      "34c44bbaa823db76f0033ae81886a259",
      "ab6dc36d777209b144ae2b79b2459ee4",
      "22e863c4c65e19f29c4a81d6127e5e2f",
      "b49ac69d6180c2b6a8d4bb479c665ee1",
      "27aec57a10e577097aa6f1de854a585f",
      "f778692e7e7d129bed53f98ea4cb1c9b",
      "4f90345d308efebc4ec3521d047b9062",
      "25109808e9d709dea5f40aa1753095d3",
      "7658c77f869c174fb4ac8119ed697fbb",
      "32c98a6a5811e7c7d1e2254e87247174",
      "a7619e4884144c7572bb9ddb63bf5d69",
      "844aa6478984f5c7c28b579c1e180be3",
      "b2fb539f8e4f0761ff992db765996231",
      "c79d96631b36d299b74089e220124e08",
      "548e5f27f47629150b3a47eecf9f80a8",
      "ddde8aee972417854fdea4576ce0ca54",
      "ca02b0f4f7616441bae5f6bbd7119e1e",
      "a1487a1a111734446c00c0f7b692cad9",
      "b0e538525292dceda275804a674ba544",
      "f226f2461ac5440bf9849c4d2da2ff54",
      "06ea93ae048c285d810d59f548a8c8d7",
      "502dc64dce41edec21e889a0091382ac",
      "325a2248f5ad979b3947db89ccc9eefc",
      "7973b622b033e85cda1094f412e9689e",
      "c1255e8e155d1a7b88208ab7868f94a3",
      "50d581b6f9988a662f9b9ac167c04d7f",
      "0e27acd98ea2f2d4cecca090311a0e4d",
      "6d28048a4ce47485af100fca0107f47b",
      "945c97cbed6e5eef63af45d8d591b8db",
      "e5d3ae2bc7865e188a20d7ba414add37",
      "f7594c10f1c7aeebdeeaa6351a16199f",
      "b1da4b1bba721f131f5b91a05045330b",
      "cf1e4d1195524b4838d8cd6549f19aad",
      "77d3efd0c4396e3644be02333ecfd403",
      "4e1e809f462bf3308f90f54bf6c41f79",
      "86769f8df6cdfb6a32bd6a0d38687759",
      "28d4b07b8964df97c42cabdffae9dc9a",
      "d25c13b1a1f1ad543959392d3fb67d18",
      "81feebb4ebb3790448b945a6d785c225",
      "d9cc85f1ae0997ea8ab00d898c2bcfc1",
      "cdf57534ae21aaf69f5d9bf407ddc076",
      "2f30566f953943da1e1395f74b31c146",
      "c3db199de2b5f05ed2532839df25fc54",
      "525a59deb6f931635b7d24ce3dc73d43",
      "3cee39e69b7ce42514c6801e63c86a45",
      "5ddd4da8a1a89eea3379852d799ea310",
      "e2088e4ac2d27d708ab41b578d1e351d",
      "f2bde3ef3e465f83c4601eeb0705466b",
      "39333c25445e5064e9573f032f79640b",
      "3164f63634bd9fe9914dc9bdd15162de",
      "c41a6023a3cafba14d1a8161eeba59f8",
      "af833d05bb0e0df9fa8968c36376249d",
      "6ced8ef45388aba00716cbdf7e623f6b",
      "66fb434206c19da807d5e33c57030f1c",
      "d646fa791f07f119b5ab1e50f5984524",
      "29955d6f1fc6e3aae5815882cd61074d"
    ],
    "color": null,
    "url": "https://studip.uos.de/seminar_main.php?auswahl=6e210f47d8aa3c186a7e59e1322f4aa9",
    "iso_chdate": "2017-03-16T12:19:32+01:00",
    "iso_start_time": "2017-04-01T00:00:00+02:00",
    "iso_visitdate": "2017-05-03T10:25:56+02:00"
  }
}
tleilax commented 7 years ago

Could you test whether the changes on the branch issue-130-documents-and-modules fix the problem? I avoided the direct access to the course's modules in SQL and used the same code that is used by the course route which should hopefully sort out the underlying issue.

mschuwalow commented 7 years ago

I am not involved with the administration of our deployment, so I cant properly test it myself. I'll forward this issue and get back to you if I get any updates.

tleilax commented 7 years ago

Elmar Ludwig just confirmed that the patch is working and thus, the changes are now merged into the master.