Commit Graph

21 Commits

Author SHA1 Message Date
Mia
ba916b7bf0 Ladder: Stop clearing User#mmrCache when rating updates time out
See comment as to why this behavior is now undesirable.
2021-09-14 19:31:52 -05:00
Guangcong Luo
9f8633ea10 Fix ladder double-update issue
Caused by #8015 incorrectly copy/pasting only parts of #7960.

I also cleaned up the ladder fast-update code while I was working
on this.
2021-03-18 10:00:11 -04:00
Mia
3d820cf38d
Ladders: Fix crash (#8015)
* Ladders: Fix crash

* OK

* Update ladders-remote.ts

* Update server/ladders-remote.ts

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>

* Update server/ladders-remote.ts

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2021-02-13 18:18:06 -08:00
Annika
5333b4629d
Revert "Calculate and display Elo change on server (#7960)" (#8014)
This reverts commit b87dd717f6.
2021-02-09 11:06:42 -08:00
Mia
76c10841ea
Lib: Add an index file for all exports (#7972) 2021-01-31 18:00:19 -08:00
Dylan S
b87dd717f6
Calculate and display Elo change on server (#7960) 2021-01-31 11:13:59 -08:00
Guangcong Luo
9d87616176
Add more style linting rules (#7537)
* Lint arrow-body-style

* Lint prefer-object-spread

Object spread is faster _and_ more readable.

This also fixes a few unnecessary object clones.

* Enable no-parameter-properties

This isn't currently used, but this makes clear that it shouldn't be.

* Refactor more Promises to async/await

* Remove unnecessary code from getDataMoveHTML etc

* Lint prefer-string-starts-ends-with

* Stop using no-undef

According to the typescript-eslint FAQ, this is redundant with
TypeScript, and they're not wrong. This will save us from needing to
specify globals in two different places which will be nice.
2020-10-19 02:42:28 -07:00
Mia
6839a1f4db
Add a library for utility functions (#6817) 2020-06-09 22:06:43 -07:00
Mia
cf42c6269a
Add a library for making HTTP/S requests (#6744) 2020-06-04 11:53:58 -07:00
Waleed Hassan
8aa4f053bb
Use optional chaining and linter improvements (#6422)
This is mostly just a follow up to #6342.

`prefer-optional-chaining` was turned on and fixed in every location it
complained in. The transformed function [0] looks expensive from a
glance but from skimming through the replaced sites it doesn't appear
to be ran in any important place, so it should be OK.

The linter improvements are:
- Increase linter performance
	- Make `full-lint` and `lint` write to different caches so we
	  avoid overwriting their caches since they're different configs
	- Change husky's hook to `npm run lint` so as to write to the
	  same cache
	- Remove `@typescript-eslint/eslint-plugin-tslint` which is
	  essentially a wrapper to TSLint because the rules aren't worth
	  running another linter
- Convert `.eslintrc.json` and `.eslintrc-syntax.json` to two spaces
  rather than four tabs to respect PS' `.editorconfig`
- Rename `fulllint` to `full-lint` to ease spelling it

[0] - https://pastie.io/mmtxpf.js (prettified)
2020-03-06 11:44:32 -08:00
Guangcong Luo
b21c9047e2
Migrate to typescript-eslint (#6342) 2020-03-05 08:33:06 -08:00
The Immortal
5798aad982
Fix LGTM warning 2019-12-11 06:41:27 +04:00
HoeenHero
f58dcbb6dd Ladders: Only display one error message 2019-12-03 15:19:48 -05:00
HoeenHero
e092caf2d2
Ladders: Delete rating cache if no response. (#6132)
If the remote ladder's update rating method dosen't receive
a response from the login server, it will not change the user's
mmrCache for the format, resulting in future ladder matches using
an outdated ELO until the server receives a response at the end of
a future match.

This is the cause of issues such as users with 1400 ELO being matched
with users with 1000 ELO with a 10 second wait time in current gen OU.

Ensuring the rating is up to date was discussed, but for cases such as
a user searching for a new match before a response is received (or an
error occurs) we decided to accept the mmrCache being at most 1 game
behind, which this change.
2019-12-01 21:47:52 -05:00
MrEconomical
dea8411ad3 Fix file extensions in comments (#6062)
Update the extensions of a bunch of files that were migrated to TypeScript in comments
2019-11-24 12:57:12 +13:00
Waleed Hassan
28e870c4fb Server: Use readonly where appropriate (#5902) 2019-10-21 16:12:32 +10:30
Waleed Hassan
da4b887054 Rename Room#id -> Room#roomid, User#userid -> User#id (#5826)
These should make it clearer that userids are IDs but roomids aren't.
2019-10-03 18:57:38 +10:00
Guangcong Luo
e0a2cf07e1 Correctly define global types for .ts files
Global types are defined differently for `.ts` files than for `.js`
files, leading to some confusion for past refactors.

This commit defines them correctly.

I'm also considering making certain global types only available under
namespaces, but I don't want to do that to `User` or `Room`, so for
now, there are no changes there, besides putting streams in the
`Streams` namespace (so `WriteStream` is now `Streams.WriteStream`).
2019-08-23 09:33:49 -07:00
Kirk Scheibelhut
951c582fe3 Add support to local /laddertop for restricting by user prefix (#5606) 2019-07-14 22:25:35 -05:00
Guangcong Luo
7436c1f0f2 Remove import = and export =
`import =` and `export =` are really only intended for backwards
compatibility with CommonJS. While I really don't like the new module
system TC39 has designed for us, it's what we should be using, and
consistency is important.
2019-05-16 01:27:07 +04:00
jetou
3a03568be2 TypeScript ladders-remote and ladders-local (#5490) 2019-05-09 11:09:27 -07:00