diff --git a/party/mate.py b/party/mate.py index 1658a46..1861ee9 100644 --- a/party/mate.py +++ b/party/mate.py @@ -28,7 +28,7 @@ class MateKiste(): self.FlaschenBreite = flaschenAnzahl[0] self.FlaschenHoehe = flaschenAnzahl[1] - flaschenAnzahl = self.FlaschenBreite * self.FlaschenHoehe + flaschenAnzahl = (self.FlaschenBreite * self.FlaschenHoehe) self.collection.insert_one({'mateKiste': True, 'status': generate_kiste(flaschenAnzahl)}) self.initialized = True @@ -39,5 +39,5 @@ class MateKiste(): @classmethod def removeAt(self, x: int, y: int): - position = y * self.FlaschenBreite + x - self.collection.update_one({'mateKiste': True}, {'$set': {'status.' + str(position): False}}) + position = x * self.FlaschenBreite + y # for whatever reason y and x are swapped here lamoooo dont touch this + self.collection.update_one({'mateKiste': True}, {'$set': {f'status.{str(position)}': False}}) diff --git a/party/static/js/mate.js b/party/static/js/mate.js index decf45f..da55254 100644 --- a/party/static/js/mate.js +++ b/party/static/js/mate.js @@ -29,9 +29,7 @@ function getMateStatus(socket) { const flascheTrinkenButton = document.createElement('button'); flascheTrinkenButton.classList.add('flasche-trinken-button'); - flascheTrinkenButton.disabled = !flascheIstVoll; - if (!flascheIstVoll) flascheTrinkenButton.style.backgroundColor = 'red'; - flascheTrinkenButton.style.backgroundColor = flascheIstVoll ? '#c88a35' : '#333'; + flascheTrinkenButton.style.backgroundColor = '#c88a35'; flascheTrinkenButton.id = `flasche-trinken-button-${x}-${y}`; //TODO: remove and replace with class flascheTrinkenButton.onclick = () => { flascheTrinken(x, y) }; cell.appendChild(flascheTrinkenButton);