pressbooks / pressbooks-multi-institution

Tools for managing Pressbooks networks shared by multiple institutions
GNU General Public License v3.0
0 stars 1 forks source link

Build institutional stats page (when plugin is active) #67

Closed SteelWagstaff closed 7 months ago

SteelWagstaff commented 8 months ago

As an institutional manager, I want to see a version of the network stats page with information that's specifically relevant to usage at my institution.

Expected behaviour:

Notes

When prioritizing which visualizations are most important, start at top and work down the page. Koko Downloads is most important, users & books over time are next, then user revisions over time, then cloned books, and network storage last. It's least important for institutional managers.

richard015ar commented 7 months ago

WIP:

So far I added hooks for the page title (Network/Institution Name Stats), and for filtering the CSV. I'll have to add the institution name field as a next step. And much more to come next week.

richard015ar commented 7 months ago

WIP still in:

Done:

Pending:

Progress can be tested on https://ricardodev.pressbooks.network/

tw77 commented 7 months ago

I did some testing on ricardodev of the WIP. Looking good, just a couple of things I noticed:

I cloned a book from my institution as an IM within the network in order to test updating the Books Over Time stats. Total Books increased by 1, but Cloned Books didn't increase.

Screenshot 2024-03-11 at 10 47 44 PM Screenshot 2024-03-11 at 10 55 14 PM

This might be a pre-existing issue, but it seems like the y-axis for Books Over Time should only use integers since there can never be 0.5 of a book for example.

richard015ar commented 7 months ago

Thank you for the early testing, @tw77 . I'll investigate and see if it's a preexisting bug. I think it might, but I'll double-check.

SteelWagstaff commented 7 months ago

The y-axis issue with decimal display is preexisting behaviour and outside the scope of this ticket.

tw77 commented 7 months ago

The only thing I'm not sure about is the cause of the separate issue I saw: Total Books number incrementing but the Cloned Books number not incrementing.

richard015ar commented 7 months ago

It is weird because it works on my local. I think it might be we need to run the analytics cron to count on new clones. I will take a look.

For my record, I think I will need to restructure the hooks a little bit. I noticed some abstractions I can do on the code. I'll work on it later today and tomorrow.

SteelWagstaff commented 7 months ago

@tw77 if you log in as super admin and run https://ricardodev.pressbooks.network/wp-admin/network/admin.php?page=pb_network_analytics_booklist_sync and then reload the stats page, is the count corrected?

tw77 commented 7 months ago

This had no effect on the count. However, I'm about to try cloning a book from a different network to ricardodev to see what happens there. The issue I saw was when cloning a book from the network within the network.

tw77 commented 7 months ago

Cloning a book from outside ricardodev to ricardodev also didn't change the Cloned Books count in Books Over Time that I'm seeing as an IM.

To summarize, as an IM viewing Stats I haven't been able to get the Cloned Books count to increase. All other counts in Books Over Time (Total Books, Public Books, Private Books) are able to increase as expected.

tw77 commented 7 months ago

Oh, the Cloned Books count just updated! Though only by 1. And it took a bit longer to update than the other counts.

Because the Cloned Books count is still 1 less than expected, I suspect the clone of a book from an outside network to ricardodev was counted, but the clone of a book from inside ricardodev was not.

I will check to see if that occurs as a network manager on Staging, for reference.

tw77 commented 7 months ago

I've found that this is a pre-existing issue outside the scope of this ticket. Cloning a book from a network within the same network doesn't increment the Cloned Books count in the Stats page for that network. Only clones from other networks to the network are included in that count, currently. This occurs as a network manager on https://staging.pressbooks.network/ just as I encountered it as an IM on ricardodev.

richard015ar commented 7 months ago

Thank you @tw77 for testing and investigating the most cloned books issue. I think I have an idea about the reason for it, but I am not sure.

PRs ready for review in:

@tw77 I addressed all the pending items I mentioned earlier. These changes are updated now on ricardodev and ready for testing in case you want to do it before it is merged. I left testing notes at https://github.com/pressbooks/pressbooks-multi-institution/pull/89#issue-2182668699. Just note that I refreshed the DB on my dev network to get the latest DB changes (Dalcin's PR)

tw77 commented 7 months ago

All expected behaviour working on dev.pressbooks.network.