Arbeitsblätter: Abo-Vorgabe bei Einrichtungs-Tickets
Bei Tickets mit einrichtungAbrechnung 'abo' steht "Vom Abo-Stundenkonto abziehen" im Dialog von Anfang an auf an (auch wenn der Abo-Status erst nach dem Öffnen ankommt), beim Nachtragen der Zeit eines Git-Blatts wird countsToPlan beim ersten Eintragen gesetzt. 'projekt', Kommentare und Kunden ohne Wartungs-Abo bekommen keine Vorgabe; ein von Hand abgehakter Haken bleibt aus. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e59ad44bd
commit
f0d39f2eee
5 files changed
+86
-7
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { loadModule } from './load.mjs'
|
||||
const { EINRICHTUNG_ABRECHNUNGEN, einrichtungAbrechnung, countsToPlanVorgabe, countsToPlanWert, nachtragPlanFelder } = await loadModule('src/lib/planVorgabe.js')
|
||||
const abo = { einrichtungAbrechnung: 'abo' }, projekt = { einrichtungAbrechnung: 'projekt' }
|
||||
|
||||
test('einrichtungAbrechnung: nur exakt abo oder projekt', () => {
|
||||
assert.deepEqual(EINRICHTUNG_ABRECHNUNGEN, ['abo', 'projekt'])
|
||||
assert.deepEqual([abo, projekt, {}, null, undefined, { einrichtungAbrechnung: 'Abo' }, { einrichtungAbrechnung: 5 }].map(einrichtungAbrechnung), ['abo', 'projekt', '', '', '', '', ''])
|
||||
})
|
||||
test('countsToPlanVorgabe: nur Abo-Einrichtung mit erlaubten Stunden', () => {
|
||||
assert.equal(countsToPlanVorgabe(abo, true), true)
|
||||
for (const [t, ok] of [[abo, false], [abo, undefined], [projekt, true], [{}, true], [null, true]]) assert.equal(countsToPlanVorgabe(t, ok), false)
|
||||
})
|
||||
test('countsToPlanWert: Vorgabe, späte Antwort des Abo-Status, Handwahl, Kommentar', () => {
|
||||
const w = (o) => countsToPlanWert({ gewaehlt: null, ticket: abo, aboHoursAllowed: true, isComment: false, ...o })
|
||||
assert.equal(w({}), true) // unberührt: Vorgabe
|
||||
assert.equal(w({ aboHoursAllowed: false }), false) // Abo-Status lädt noch
|
||||
assert.equal(w({ aboHoursAllowed: true }), true) // …und kommt danach: die Vorgabe greift trotzdem
|
||||
assert.equal(w({ gewaehlt: false }), false) // von Hand abgehakt bleibt aus
|
||||
assert.equal(w({ gewaehlt: true, ticket: projekt }), true) // von Hand anhaken ist immer möglich
|
||||
assert.equal(w({ gewaehlt: true, aboHoursAllowed: false }), false)
|
||||
assert.equal(w({ ticket: projekt }), false)
|
||||
assert.equal(w({ ticket: {} }), false)
|
||||
for (const gewaehlt of [null, true, false]) assert.equal(w({ gewaehlt, isComment: true }), false)
|
||||
})
|
||||
test('nachtragPlanFelder: nur das erste Nachtragen einer Git-Zeit auf einer Abo-Einrichtung', () => {
|
||||
const git = { serviceType: 'GIT', isComment: true, startTime: '', totalTime: 0, countsToPlan: false }
|
||||
const f = (o) => nachtragPlanFelder({ worksheet: git, ticket: abo, aboHoursAllowed: true, ...o })
|
||||
assert.deepEqual(f({}), { countsToPlan: true })
|
||||
assert.deepEqual(f({ ticket: projekt }), {})
|
||||
assert.deepEqual(f({ ticket: {} }), {})
|
||||
assert.deepEqual(f({ aboHoursAllowed: false }), {})
|
||||
assert.deepEqual(f({ worksheet: { ...git, startTime: '0900', totalTime: 45 } }), {}) // Zeit ist schon eingetragen: Entscheidung bleibt
|
||||
assert.deepEqual(f({ worksheet: { ...git, countsToPlan: true } }), {})
|
||||
assert.deepEqual(f({ worksheet: { serviceType: 'Remote', totalTime: 0, startTime: '' } }), {})
|
||||
})
|
||||
Reference in new issue
Block a user