HGustavs / LenaSYS

Code Viewer and Course Organization System used in some courses at University of Skövde
57 stars 31 forks source link

Go over the test for loadDugga_ms.php again #15361

Open f22linhe opened 6 months ago

f22linhe commented 6 months ago

See parent issue: Create new tests for the microservices created from showDuggaservice.php #15162

The test for this microservice was created before the retrieveShowDuggaService_ms.php was created. Therefore, go over the test again and make sure it works once the retrieveShowDuggaService_ms.php has been implemented. If it does not work as aspected, make sure it does.

Note, this issue cannot be resolved until this issue has been resolved:

Create a retrieveShowDuggaService microservice #15271

b21isabe commented 6 months ago

The test no longer works since the original output has been removed, I will try to integrate the retrieve service with the microservice and restore the output before I start working on updating the test.

b21isabe commented 6 months ago

The current function of the microservice is unclear, it seems to gather some data but doesn't use it in any way. I don't feel comfortable changing the microservice since I don't know how/where it is supposed to be used. I will let go of this issue so that someone more knowledgeable on showDuggaService can do it.

a22marca commented 6 months ago

Seems loadDugga is included in retrieveShowDugga_ms.

    if (isSuperUser($userid)){
        if($hash!="UNK"){
            include_once("loadDugga_ms.php");

            $sql="SELECT entryname FROM listentries WHERE lid=:moment";
            $query = $pdo->prepare($sql);
            $query->bindParam(':moment', $moment);
            $query->execute();
            foreach($query->fetchAll() as $row){
                $duggatitle=$row['entryname'];
            }

This is the reason why this microservice does not call retrieveShowDuggaService()`, because it is used by the function instead.

I think this test can be implemented by using the getShowDugga microservice, since that will call retrieveShowDuggaService, which in turns uses loadDugga. This is not the best solution, but we don't need to start making large changes to the microservice in /showDuggaService before the project ends.

a22marca commented 6 months ago

I believe the loadDugga microservice is not providing all functionality it should, or at least there are some missing microservices from showDugga. There are three different cases to load a dugga:

loadDugga_ms only provides functionality for CASE 1 partially.

The microservice retrieveShowDugga implements all the cases and includes loadDugga in the part of the code that handles CASE 1.

I agree with @b21isabe here, this test is probably not a good idea to implement currently. The best way to solve this is probably to refactor the whole selection regarding the cases i mentioned and try to structure different parts in to different microservices. The easy route is to place all the cases inside of loadDugga_ms.php. A third option is to make loadDugga a function that returns the values needed in retrieveShowDugga.