Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

2 Arrays mit Ruby on Rails

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich habe ein Problem mit Ruby on Rails ,hoffe das ich hier richtig bin.

Ich habe 2 Arrays welche wie folgt aussehen

(können theoretisch unendlich lang werden)

Array 1(trans)

0 Einbau

1 Ausbau

2 Einbau

usw

Array 2 (datum)

0 12:11:2008

1 17:11:2008

2 19:11:2008

usw

Jetzt soll die Differenz zwischen Ausbau und Einbau berechnet werden.

Es kann aber auch mal passieren das Jemand einen Eintrag vergessen hat

und auf einen Ausbau ein Ausbau oder auf einen Einbau ein Einbau folgt.

Oder das der erste Eintrag ein Ausbau ist.

Ich dachte an sowas wie wenn im Array 1 auf einen Ausbau ein Einbau folgt,

dann nehme von Array 2 das Datum Einbau - Datum Ausbau (Wert speichern ) und weiter.

Am besten wäre irgendwie ein Schleifendurchlauf mit array.length oder sowas wie

def suche_in_Array

i = 0

if trans = Ausbau & trans[i +1] = Einbau

get datum [i+1] - datum # zwischenspeichern

i = i+1

end

Hat jemand eine Idee ?

Vielen Dank schonmal

MfG

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.