Skip to content

Conversation

@agoujot
Copy link
Member

@agoujot agoujot commented Apr 16, 2025

Problem: when the user changes the timezone, currently the sums at the right don't get updated.

Solution: replacing timeCardDatasets in the callback line 339 with chart.data.datasets.

timeCardDatasets is the initial value, whereas chart.data.datasets is the updated value (timeCardDatasets doesn't get updated because we do chart.data.datasets = chart.data.datasets.map(...))

(And this time it's in a language I've written a lot in.
And of course, I forgot to link to the bug in the commit again...)

Bug: T385962

agoujot added 2 commits April 16, 2025 16:17
by replacing timeCardDatasets line 339 with chart.data.datasets.

timeCardDatasets is the initial value, whereas chart.data.datasets is the updated value (timeCardDatasets doesn't get updated because we do chart.data.datasets = chart.data.datasets
@MusikAnimal
Copy link
Member

There's a build step that needs to be ran locally. Let me see if I can take care of that for you.

@codecov
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.96%. Comparing base (4b8eb28) to head (e29b273).
Report is 70 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #497      +/-   ##
============================================
- Coverage     71.30%   70.96%   -0.35%     
- Complexity     1275     1293      +18     
============================================
  Files            46       46              
  Lines          3792     3892     +100     
============================================
+ Hits           2704     2762      +58     
- Misses         1088     1130      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@MusikAnimal MusikAnimal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully an easy fix.

@agoujot
Copy link
Member Author

agoujot commented Apr 17, 2025

This is weird. I was afraid of such issues, so I made a quick test in the console:

window.test = [ { fun : () => console.log(test[1].data) }, { data:"hello!" } ];
test[0].fun()

And it worked, it did output hello.

Perhaps the callback is called during initalisation of the variable, too.

Eh, whatever. window.chart ? chart.data.datasets : timeCardDatasets should work fine.

by using window.chart ? chart.data.datasets : timeCardDatasets
@agoujot agoujot requested a review from MusikAnimal April 17, 2025 08:20
@MusikAnimal MusikAnimal dismissed their stale review April 17, 2025 20:17

make a new review

Copy link
Member

@MusikAnimal MusikAnimal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer errors, but unfortunately it doesn't work. The values on the right stay the same. I did a little debugging and it seems chart.data.datasets apparently isn't updated (?)

I can try to debug more, but this might be easier if we can get your dev environment set up. I'm happy to help with that. If you a Wikimedia developer account, and you've used Toolforge before (i.e. have SSH keys set up), you're already most of the way there. Development docs are at https://www.mediawiki.org/wiki/XTools/Development

@agoujot
Copy link
Member Author

agoujot commented Apr 17, 2025

Yeah, I really should take time and set up a dev environment.

Reading the list for the first time, I think I have everything except the git setup. But I'll probably manage.

@agoujot
Copy link
Member Author

agoujot commented Apr 17, 2025

I'd appreciate if you could lend a hand. I think I've done everything right, but I'm getting an exception: SQLSTATE[HY000] [2002] Connection refused.

With mariadb I get ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2). What exactly should I do? I found a lot of conflicting answers out there.

Being on a weird linux distribution and not having updated my package list for a year or two doesn't help, but normally I have versions >= the requirements.

@MusikAnimal
Copy link
Member

I'd appreciate if you could lend a hand. I think I've done everything right, but I'm getting an exception: SQLSTATE[HY000] [2002] Connection refused.

With mariadb I get ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2). What exactly should I do? I found a lot of conflicting answers out there.

For Linux, I think you should be able to get by with just the PHP adapter: apt install php-mysql (or php8.1-mysql, whatever version matches your local PHP version). You don't actually need a MySQL server running, since you'll want to develop against the replicas.

We can also chat in realtime, either on IRC or Discord. I'm MusikAnimal in both places.

We have a two-year old PR to create a Docker container (#441). I wish I knew enough about Docker to get that finished…

@agoujot
Copy link
Member Author

agoujot commented Apr 18, 2025

(Left a friend request at discord.)

On SQLSTATE[HY000] [2002] Connection refused: I suppose it's an issue with my replica config? It's

DATABASE_HOST=127.0.0.1
DATABASE_PORT=
DATABASE_NAME=
DATABASE_USER=
DATABASE_PASSWORD=

DATABASE_REPLICA_USER=[usernameexactlyasinreplica.my.cnf]
DATABASE_REPLICA_PASSWORD=[passwordexactlyasinreplica.my.cnf]
DATABASE_REPLICA_HOST_S1=127.0.0.1
DATABASE_REPLICA_PORT_S1=4711
DATABASE_REPLICA_HOST_S2=127.0.0.1
DATABASE_REPLICA_PORT_S2=4712
DATABASE_REPLICA_HOST_S3=127.0.0.1
DATABASE_REPLICA_PORT_S3=4713
DATABASE_REPLICA_HOST_S4=127.0.0.1
DATABASE_REPLICA_PORT_S4=4714
DATABASE_REPLICA_HOST_S5=127.0.0.1
DATABASE_REPLICA_PORT_S5=4715
DATABASE_REPLICA_HOST_S6=127.0.0.1
DATABASE_REPLICA_PORT_S6=4716
DATABASE_REPLICA_HOST_S7=127.0.0.1
DATABASE_REPLICA_PORT_S7=4717
DATABASE_REPLICA_HOST_S8=127.0.0.1
DATABASE_REPLICA_PORT_S8=4718

DATABASE_TOOLSDB_HOST=127.0.0.1
DATABASE_TOOLSDB_PORT=4720

having done

ssh -f -L 4711:s1.web.db.svc.wikimedia.cloud:3306 -L 4712:s2.web.db.svc.wikimedia.cloud:3306 -L 4713:s3.web.db.svc.wikimedia.cloud:3306 -L 4714:s4.web.db.svc.wikimedia.cloud:3306 -L 4715:s5.web.db.svc.wikimedia.cloud:3306 -L 4716:s6.web.db.svc.wikimedia.cloud:3306 -L 4717:s7.web.db.svc.wikimedia.cloud:3306 -L 4718:s8.web.db.svc.wikimedia.cloud:3306 -L 4720:tools.db.svc.eqiad.wmflabs:3306 -N alien4444@login.toolforge.org

to setup the tunnels (I added -f to make it run in the background, else it actually ssh'd into toolforge and there I can't install anything, and -N because else it complains).

@agoujot
Copy link
Member Author

agoujot commented Apr 22, 2025

There we go! Found the issue: even if we change the y property of an hour bubble, it's still classified within its original day; so I just filtered all hours to keep only those that in the end land in the right day. As we've got a fixed N of 7*24=168 that really isn't big, it should be fine.

@agoujot agoujot requested a review from MusikAnimal April 22, 2025 00:35
Copy link
Member

@MusikAnimal MusikAnimal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 😄

n.b. use npm run build to compile the assets before committing, which will remove the old ones automatically. I know this is annoying but we don't have a build pipeline for deployments yet.

You can also use npm run watch during development, so you don't have to manually rebuild constantly.

@MusikAnimal MusikAnimal merged commit 0b47bf5 into x-tools:main Apr 23, 2025
2 of 3 checks passed
@agoujot
Copy link
Member Author

agoujot commented Apr 23, 2025

I did figure it out eventually; my issue is I haven't figured out how to commit with git yet (yes, really 🤡), so I'm using the github UI that only lets you change a few files at a time.

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

Successfully merging this pull request may close these issues.

2 participants