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

Sharing Cart no longer working with our Course Format #214

Open
Richardvi opened this issue Aug 28, 2024 · 27 comments
Open

Sharing Cart no longer working with our Course Format #214

Richardvi opened this issue Aug 28, 2024 · 27 comments
Assignees

Comments

@Richardvi
Copy link

Richardvi commented Aug 28, 2024

Hi @donhinkelman (and others?),

Our teachers really like to use the Sharing Cart, however after our last update to Moodle 4.4 the Sharing Cart is no longer working for us. We can add content to the cart, but we can't put it back into the course.

For us it's a bit a unique situation as we are using our own course format. I would really like to share our course format with you, perhaps you can see why it's no longer working. And perhaps if you understand why it's not working for us, you can make the sharing cart plugin even better (because I could understand that more custom course formats could have the same problem).

Can I come into contact with you, send our custom course format, and you could perhaps see why the sharing cart is not working? This might be a lot I'm asking, I know, so please feel free to react accordingly.

As a Dutch person, we are not shy of direct responses :)

@effgarces
Copy link

We are having the same issue, in our case we traced it to the Collapsible Topics format, if a course has this format then the sharing cart does not work properly. If we change it to the Topics format it behaves as expected.

@Richardvi
Copy link
Author

Interesting. But I think I understand why this happens, and it would be nice if we get the sharing cart working in all course formats.

@donhinkelman
Copy link
Owner

donhinkelman commented Sep 15, 2024

Thanks for reporting this issue, Richard, and thanks effgarces for finding the possible cause. May I confirm, Richard, that this problem only happens when you use the Collapsible Topics format or your own format? Did you try switching to Topics format? What happened?

I can assign moxis team to look into the problem, but our custom has been to build the Sharing Cart for standard themes and course formats (there are so many in Moodle, we cannot make it universally compatible to all formats). Is Collapsible Topics a standard format? If it is custom/non-standard, do you have a programmer friend who could fix it and contribute a pull-request?

@Richardvi
Copy link
Author

Richardvi commented Sep 16, 2024

Hi @donhinkelman !
I don't know if this happens in Collapsible Topics. @effgarces says so. But we have our own course format.

Can you tell me a little bit on how you add the extra sharing cart stuff to the course format? Right now, for us, everything works except the placeholder where you would like to copy something to.

So sharing cart works, sharing cart block works, we can copy stuff into the sharing cart - but we can't get in out of the sharing cart onto the course page.

I'd be happy to share our course format with you if you would like to take a look in your test environment.

@effgarces
Copy link

The course format Collapsible Topics is a plugin available at https://moodle.org/plugins/format_collapsibletopics (yes we are aware that is deprecated, but it's working well so far and we will probably maintain it for some time if it is required).
As mentioned by @Richardvi the issue is the placeholder that is not working properly, or better is not being inserted.

@frederikmillingpytlick
Copy link
Collaborator

Hi @Richardvi and @effgarces,

Which version of the sharing cart do you use? It may already be fixed in the latest version of sharing cart

@Richardvi
Copy link
Author

The latest version afaik. Version
image

@Richardvi
Copy link
Author

Ah, now I see. On Github there's a newer version that hasn't been pushed to the Moodle plugin database yet. Let me try that one :)

@frederikmillingpytlick
Copy link
Collaborator

frederikmillingpytlick commented Sep 17, 2024

@Richardvi Be aware that we've totally refactored the plugin in the new version, so the backups you've made before upgrading will be marked as legacy and will not support all the new sharing cart features. You will still be able to backup/restore them one at a time though

@Richardvi
Copy link
Author

Richardvi commented Sep 17, 2024

Thanks! I was going to test this in production, living on the edge - but you convinced me otherwise. I will go to our test server first haha

@Richardvi
Copy link
Author

Auch! The new Sharing Cart totally kills my Moodle course...
image

@Richardvi
Copy link
Author

I will bug hunt a little.

It seems I get that error as soon as the Sharing Cart block is added to a course.

@Richardvi
Copy link
Author

Quite interesting so far. The Sharing Cart version from GitHub installed perfectly, no errors, but obviously a table block_sharing_cart_items is missing. These are the tables that I do have from the sharing cart:

image

So where is block_sharing_cart_items?

@frederikmillingpytlick
Copy link
Collaborator

@Richardvi Have you run the DB upgrade on your site? - Those tables should have been deleted and a new one should have been created

@Richardvi
Copy link
Author

I just downloaded all files from github as a .zip, then uploaded that zip as a plugin. Moodle started installing the new plugin.

Was that wrong?

For those wondering, this is the SQL I made from the db/install.xml

CREATE TABLE block_sharing_cart_items (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT(10) UNSIGNED NOT NULL,
file_id INT(10) UNSIGNED,
parent_item_id INT(10) UNSIGNED,
old_instance_id INT(10) UNSIGNED NOT NULL,
type CHAR(255) NOT NULL,
name CHAR(255) NOT NULL,
status INT(10) UNSIGNED NOT NULL,
sortorder INT(10) UNSIGNED,
timecreated INT(10) NOT NULL,
timemodified INT(10) NOT NULL,
PRIMARY KEY (id),
INDEX user_id (file_id),
UNIQUE INDEX file_id (file_id),
INDEX parent_item_id (parent_item_id),
INDEX type (type),
INDEX status (status)
) COMMENT='Table to store cart items';

@Richardvi
Copy link
Author

Yeah no, that's not working... I will need to completely uninstall the sharing cart module and start again

@frederikmillingpytlick
Copy link
Collaborator

I found the issue. The upgrade script wasn't run because @donhinkelman & I have both made changes to the repository. We've somehow timed it perfectly to break the upgrade script. I'll fix it asap

@frederikmillingpytlick
Copy link
Collaborator

@Richardvi I've just updated git, now the upgrade script should work properly upgrading from version 2024072900

@Richardvi
Copy link
Author

Did you increase the version number a bit? That helps :)

@Richardvi
Copy link
Author

Unfortunately, the new version does not solve the problem. Please look at the screenshot. So every thing seems to be working fine, but there's simply no place holder to put the content in from the sharing cart:

image

@frederikmillingpytlick
Copy link
Collaborator

frederikmillingpytlick commented Sep 17, 2024

@Richardvi If it still doesn't work it may be because your custom course format strays to far away from moodle's default course format structure. We've tested it on all Moodle Core course formats and a couple of third party ones as well although we don't officially support them. All of the ones we tested worked as expected.

If you run the following in your browser console what output do you get? - These are the selectors we use to find all places to implement a restore in section button.

document.querySelector('.course-content');
document.querySelectorAll('.course-content [data-for="cmlist"]');

If you get no results from the above code, you could adapt your course format to match the selectors :)

Here is an example of a container we get in format_topics
image

@carlicockrell
Copy link

Hi Sharing Cart team,
I believe this problem actually extends to the course format that was previously called "Topics" and is now "Custom Sections." It was changed in Moodle 4.4, and I can reproduce that you cannot place items from your Sharing Cart into "Custom Sections" which is the "new" version of Topics. (Moodle doc for reference to the change: https://docs.moodle.org/405/en/Course_formats) There is also support in 4.5 for subsections, so I think it's likely related to some of these new features that has caused an issue with this plugin on newer Moodle versions.

@frederikmillingpytlick
Copy link
Collaborator

Hi @carlicockrell,

Do you have the following admin setting enabled? - If enabled, this setting breaks the sharing cart restores since it doesn't factor in that you can take backups of sections. See: https://tracker.moodle.org/browse/MDL-82750
image

Backup/restore in the sharing cart works fine for me on 4.4 after disabling this

@carlicockrell
Copy link

@frederikmillingpytlick I can confirm this is not something we do not have on. The issue is that using Custom Sections (new Topics), when you copy an item, it never moves from "Copying this shared item" and you also cannot place it anywhere. However, if you switch to a different course format, you can place the copied item accordingly. I'm happy to start a new issue, but thought the issues all sounded similar in nature, and wondered if the course formats do factor in.

@frederikmillingpytlick
Copy link
Collaborator

@carlicockrell I'd need some more information to debug this. I can't reproduce it on a clean Moodle 4.4 site

@donhinkelman
Copy link
Owner

@carlicockrell I can confirm that course formats are frequent cause of bugs, particularly custom course formats. Note that section copy is a feature of the Sharing Cart that is a few years old. Sharing Cart versions go back almost twenty years. We thank Frederik and all the great staff at Moxis for handling these important but tedious bugs as Moodle course formats evolve.

@carlicockrell
Copy link

@frederikmillingpytlick @donhinkelman I will double check this on a clean 4.4 site and report back in a new issue as I isolate this more. I'm also asking my other team members if anyone else is using this successfully in 4.4 or 4.5 using Custom Sections (formerly Topics).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants