nomad-nmr / nomad-server

Server side code for NOMAD system
https://www.nomad-nmr.uk/
GNU Affero General Public License v3.0
3 stars 2 forks source link

Add grant column into the users accounting calculation table #137

Open tomlebl opened 1 week ago

tomlebl commented 1 week ago

We could reuse function getGrantIfo function exported from accountsUtils.js to find grant code for each user in the table. Grants assigned to the user in the time of calculation would get listed. It should be mentioned in a tooltip!

tomlebl commented 2 days ago

@hunxjunedo I assume that this one could be good for you. Let me know if you would fancy to take it on.

hunxjunedo commented 2 days ago

Sure, just describe it a bit. And assign it.

tomlebl commented 2 days ago

In the accounting tables for "Users" calculation (each entry of the table is user), we need to add a new column "Grant Code" next to "User Name" column. You will have to adjust the controller (accounts.js , getCosts function) in the API to get the data. It should be relatively straightforward as you can reuse getGrantIfo function exported from accountsUtils.js. It should take userId as an argument and find the corresponding grant. You will just need to tweak it that you get grantCode in the output. If it does not make sense then ask.

hunxjunedo commented 1 day ago

@tomlebl is everything working good on your end ? the frontend container kept crashing, checked the logs and found this:
`✘ [ERROR] Failed to resolve entry for package "ml-gsd". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle]

node_modules/esbuild/lib/main.js:1225:21:
  1225 │         let result = await callback({
       ╵                      ^

at packageEntryFailure (file:///app/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:46575:15)
at resolvePackageEntry (file:///app/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:46572:3)
at tryNodeResolve (file:///app/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:46388:16)
at ResolveIdContext.resolveId (file:///app/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:46138:19)
at PluginContainer.resolveId (file:///app/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:48953:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///app/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:66209:15
at async file:///app/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:46889:28
at async requestCallbacks.on-resolve (/app/node_modules/esbuild/lib/main.js:1225:22)
at async handleRequest (/app/node_modules/esbuild/lib/main.js:647:11)

This error came from the "onResolve" callback registered here:

node_modules/esbuild/lib/main.js:1150:20:
  1150 │       let promise = setup({
       ╵                     ^

at setup (file:///app/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:46872:13)
at handlePlugins (/app/node_modules/esbuild/lib/main.js:1150:21)
at buildOrContextImpl (/app/node_modules/esbuild/lib/main.js:873:5)
at Object.buildOrContext (/app/node_modules/esbuild/lib/main.js:699:5)
at /app/node_modules/esbuild/lib/main.js:2032:68
at new Promise (<anonymous>)
at Object.context (/app/node_modules/esbuild/lib/main.js:2032:27)
at Object.context (/app/node_modules/esbuild/lib/main.js:1874:58)
at prepareEsbuildOptimizerRun (file:///app/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:50862:33)

The plugin "vite:dep-pre-bundle" was triggered by this import

node_modules/nmrium/lib/data/data1d/Spectrum1D/getReferenceShift.js:2:20:
  2 │ import { gsd } from 'ml-gsd';
    ╵                     ~~~~~~~~`

have you changed this after my last commit ?

hunxjunedo commented 1 day ago

just checked, they had a publish 2 hrs ago: https://github.com/mljs/global-spectral-deconvolution/commit/26a22da865db9f3173d4f37da09537792971ca72

tomlebl commented 1 day ago

@hunxjunedo all good on my end. I assume that you have pulled my main branch before you gets started. How did you start after that? Did you use docker-compose up -d --build?

hunxjunedo commented 1 day ago

My bad, didn't use --build

tomlebl commented 1 day ago

I thought that could be the case. Remember that you need to use --build flag every time you change dependencies.

hunxjunedo commented 21 hours ago

I dived into it and still the issue is with this package ml-gsd:

image

its working on your end as it might be using an older version, try running npm i in the container and see what happens.

https://github.com/mljs/global-spectral-deconvolution/issues/124