Chaosthebot / Chaos

A social coding experiment that updates its own code democratically.
http://chaosthebot.com
MIT License
2.44k stars 210 forks source link

Dump meritocracy data alongside voters.json #462

Closed mdcfe closed 7 years ago

mdcfe commented 7 years ago

Will be dropped in the root of the web server when generated.

PlasmaPower commented 7 years ago

This will append the new meritocracy json to the old one, similar to the broken voters json issue. Why not just open it once in w mode?

@davidak rescind review?

rudehn commented 7 years ago

``r+'' Open for reading and writing. The stream is positioned at the beginning of the file.

That doesn't sound good... Why not just use "r" and "w"?

PlasmaPower commented 7 years ago

Why not just w? We never read from it.

I think r+ would work if we called truncate before writing to it.

PlasmaPower commented 7 years ago

And yes, this won't append to the file, but it will cause problems. Example:

Write 1: abc Write 2: de

Result: dec

That's because we don't truncate the file, so old data gets left behind.

rudehn commented 7 years ago

@PlasmaPower I mean use "r" and "w" in a general sense.

mdcfe commented 7 years ago

Oops, I'll amend that now. Forgot about file modes 😟

chaosbot commented 7 years ago

:ok_woman: PR passed with a vote of 17 for and 0 against, a weighted total of 16.5 and a threshold of 6.5, and a current meritocracy review.

See merge-commit 2596dd8c0be777f8807868e179fc6176d58e5ba5 for more details.

phil-r commented 7 years ago

This crashes chaos for me with TypeError: Object of type 'set' is not JSON serializable

PlasmaPower commented 7 years ago

Looks like we need to turn it into a list first. Fixing.