-export function extractTime(timeControl)
-{
- const tcParts = timeControl.replace(/ /g,"").split('+');
- const mainTimeArray = tcParts[0].match(/([0-9]+)([smhd])/);
- if (!mainTimeArray)
- return null;
- const mainTimeValue = parseInt(mainTimeArray[1]);
- const mainTimeUnit = mainTimeArray[2];
- const mainTime = timeUnitToSeconds(mainTimeValue, mainTimeUnit);
- let increment = 0;
- if (tcParts.length >= 2)
- {
- const increment = tcParts[1].match(/([0-9]+)([smhd])/);
- if (!increment)
- return null;
- const incrementValue = parseInt(increment[1]);
- const incrementUnit = increment[2];
- // Increment unit cannot be larger than main unit:
- if (isLargerUnit(incrementUnit, mainTimeUnit))
- return null;
- increment = timeUnitToSeconds(incrementValue, incrementUnit);
- }
- return {mainTime:mainTime, increment:increment};
-}
+export function checkChallenge(c) {
+ const vid = parseInt(c.vid, 10);
+ if (isNaN(vid) || vid <= 0) return "Please select a variant";