Merge branch 'fix-build' into 'master'

Fix build

See merge request dungeonslayers/ds4!173
This commit is contained in:
Johannes Loher 2022-02-13 18:50:00 +00:00
commit 0c8f1e8bda
2 changed files with 18 additions and 8 deletions

View file

@ -6,7 +6,7 @@
image: node:lts image: node:lts
stages: stages:
- test - check
- build - build
- prepare-release - prepare-release
- release - release
@ -17,7 +17,7 @@ cache: &global_cache
- .yarn/cache - .yarn/cache
lint: lint:
stage: test stage: check
before_script: before_script:
- yarn install --immutable - yarn install --immutable
script: script:
@ -25,8 +25,17 @@ lint:
cache: cache:
<<: *global_cache <<: *global_cache
typecheck:
stage: check
before_script:
- yarn install --immutable
script:
- yarn typecheck
cache:
<<: *global_cache
test: test:
stage: test stage: check
before_script: before_script:
- yarn install --immutable - yarn install --immutable
script: script:
@ -40,7 +49,7 @@ test:
- junit.xml - junit.xml
reuse: reuse:
stage: test stage: check
image: image:
name: fsfe/reuse:latest name: fsfe/reuse:latest
entrypoint: [""] entrypoint: [""]

View file

@ -19,21 +19,22 @@ export function calculateSpellPrice(data: DS4SpellDataSourceData): number | null
function calculateSpellPriceFactor(temporalData: UnitData<TemporalUnit>): number { function calculateSpellPriceFactor(temporalData: UnitData<TemporalUnit>): number {
let days: number; let days: number;
if (Number.isNumeric(temporalData.value)) { if (Number.isNumeric(temporalData.value)) {
const value = Number.fromString(temporalData.value);
switch (temporalData.unit) { switch (temporalData.unit) {
case "days": { case "days": {
days = temporalData.value; days = value;
break; break;
} }
case "hours": { case "hours": {
days = temporalData.value / hoursPerDay; days = value / hoursPerDay;
break; break;
} }
case "minutes": { case "minutes": {
days = temporalData.value / (hoursPerDay * minutesPerHour); days = value / (hoursPerDay * minutesPerHour);
break; break;
} }
case "rounds": { case "rounds": {
days = (temporalData.value * secondsPerRound) / (hoursPerDay * minutesPerHour * secondsPerMinute); days = (value * secondsPerRound) / (hoursPerDay * minutesPerHour * secondsPerMinute);
break; break;
} }
} }