projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8f5780d
)
Small fixes
author
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 31 May 2019 08:21:53 +0000
(10:21 +0200)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 31 May 2019 08:21:53 +0000
(10:21 +0200)
client/src/components/ChallengeList.vue
patch
|
blob
|
blame
|
history
client/src/utils/ajax.js
patch
|
blob
|
blame
|
history
client/src/utils/timeControl.js
patch
|
blob
|
blame
|
history
client/src/views/Hall.vue
patch
|
blob
|
blame
|
history
diff --git
a/client/src/components/ChallengeList.vue
b/client/src/components/ChallengeList.vue
index
8500515
..
c7df2dd
100644
(file)
--- a/
client/src/components/ChallengeList.vue
+++ b/
client/src/components/ChallengeList.vue
@@
-10,7
+10,7
@@
table
td {{ c.from.name }}
td(v-if="!!c.to[0]")
span(v-for="pname in c.to") {{ pname }}
td {{ c.from.name }}
td(v-if="!!c.to[0]")
span(v-for="pname in c.to") {{ pname }}
- td(v-else) {{ c.to.length
- 1 }} player{{ c.to.length >= 3
? 's' : '' }}
+ td(v-else) {{ c.to.length
}} player{{ c.to.length >= 2
? 's' : '' }}
td {{ c.timeControl }}
</template>
td {{ c.timeControl }}
</template>
diff --git
a/client/src/utils/ajax.js
b/client/src/utils/ajax.js
index
c0ebbff
..
01ea849
100644
(file)
--- a/
client/src/utils/ajax.js
+++ b/
client/src/utils/ajax.js
@@
-1,5
+1,8
@@
import params from "../parameters"; //for server URL
import params from "../parameters"; //for server URL
+// TODO: replace by fetch API ?
+// https://www.sitepoint.com/xmlhttprequest-vs-the-fetch-api-whats-best-for-ajax-in-2019/
+
// From JSON (encoded string values!) to "arg1=...&arg2=..."
function toQueryString(data)
{
// From JSON (encoded string values!) to "arg1=...&arg2=..."
function toQueryString(data)
{
diff --git
a/client/src/utils/timeControl.js
b/client/src/utils/timeControl.js
index
89f7f31
..
194deaf
100644
(file)
--- a/
client/src/utils/timeControl.js
+++ b/
client/src/utils/timeControl.js
@@
-22,8
+22,11
@@
function isLargerUnit(unit1, unit2)
export function extractTime(timeControl)
{
export function extractTime(timeControl)
{
- const tcParts = timeControl.replace(/ /g,"").split('+');
- const mainTimeArray = tcParts[0].match(/([0-9]+)([smhd])/);
+ let tcParts = timeControl.replace(/ /g,"").split('+');
+ // Concatenate usual time control suffixes, in case of none is provided
+ tcParts[0] += "m";
+ tcParts[1] += "s";
+ const mainTimeArray = tcParts[0].match(/([0-9]+)([smhd]+)/);
if (!mainTimeArray)
return null;
const mainTimeValue = parseInt(mainTimeArray[1]);
if (!mainTimeArray)
return null;
const mainTimeValue = parseInt(mainTimeArray[1]);
@@
-32,7
+35,7
@@
export function extractTime(timeControl)
let increment = 0;
if (tcParts.length >= 2)
{
let increment = 0;
if (tcParts.length >= 2)
{
- const incrementArray = tcParts[1].match(/([0-9]+)([smhd])/);
+ const incrementArray = tcParts[1].match(/([0-9]+)([smhd]
+
)/);
if (!incrementArray)
return null;
const incrementValue = parseInt(incrementArray[1]);
if (!incrementArray)
return null;
const incrementValue = parseInt(incrementArray[1]);
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
94e49a1
..
e76139a
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-81,6
+81,7
@@
import { ajax } from "@/utils/ajax";
import { getRandString } from "@/utils/alea";
import GameList from "@/components/GameList.vue";
import ChallengeList from "@/components/ChallengeList.vue";
import { getRandString } from "@/utils/alea";
import GameList from "@/components/GameList.vue";
import ChallengeList from "@/components/ChallengeList.vue";
+import { GameStorage } from "@/utils/storage";
export default {
name: "my-hall",
components: {
export default {
name: "my-hall",
components: {