diff --git a/.idea/bbb-status.iml b/.idea/bbb-status.iml
index 3c77fb3..a4225b5 100644
--- a/.idea/bbb-status.iml
+++ b/.idea/bbb-status.iml
@@ -5,7 +5,7 @@
-
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index d4e4db6..0d00bb2 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/main___plot.xml b/.idea/runConfigurations/main___plot.xml
new file mode 100644
index 0000000..61f8436
--- /dev/null
+++ b/.idea/runConfigurations/main___plot.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 43769ad..1790e1f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.8-alpine
+FROM python:3.9-alpine
WORKDIR /usr/src/
diff --git a/README.md b/README.md
index 872d347..9ee6203 100644
--- a/README.md
+++ b/README.md
@@ -29,3 +29,7 @@ Generate a new plot based on saved meeting data:
```shell
sudo docker-compose run bbb-status plot
```
+
+## example plot
+
+![plot of one month BBB usage](plot-last-month.png)
diff --git a/plot-last-month.png b/plot-last-month.png
new file mode 100644
index 0000000..eb45c23
Binary files /dev/null and b/plot-last-month.png differ
diff --git a/src/langfingaz/main.py b/src/langfingaz/main.py
index 466ba39..d8491f0 100755
--- a/src/langfingaz/main.py
+++ b/src/langfingaz/main.py
@@ -20,7 +20,7 @@ def main():
'\tplot: saves a plot of the saved BBB meeting data\n'
if len(argv) != 2:
- raise ValueError("Expected one commandline argument!")
+ raise ValueError("Expected one commandline argument!\n" + usageStr)
if argv[1] == "log":
logMeetingData.v1()
diff --git a/src/langfingaz/plotMeetings.py b/src/langfingaz/plotMeetings.py
index 9c88796..aeca0d4 100644
--- a/src/langfingaz/plotMeetings.py
+++ b/src/langfingaz/plotMeetings.py
@@ -1,3 +1,4 @@
+from datetime import datetime, timedelta
from pathlib import Path
from typing import List
import logging
@@ -25,15 +26,31 @@ def plotMeetings(dataDir: Path = fileUtil.getProjectBaseDir().joinpath("data")):
dataStr, t = loadData.loadData(file)
meetings: List[Meeting] = parseMeetings.parseMeetingsData(dataStr)
bbbStati.append(parseMeetings.BbbStatus(meetings, t))
+ if (len(bbbStati) < 1):
+ print("No bbbStatus objects could be read from data directory: " + str(dataDir))
+ return
# sort by date (x-axis)
bbbStati = sorted(bbbStati, key=BbbStatus.getKey)
+ # filter: take only bbbStatus objects of the last month (4 weeks)
+ #
+ # start: datetime = bbbStati[0].pointOfTime
+ # end: datetime = bbbStati[-1].pointOfTime
+ # delta: timedelta = end-start
+ end: datetime = bbbStati[-1].pointOfTime
+ monthBeforeEnd: datetime = end - timedelta(days=28)
+ bbbStati = [bbbStatus for bbbStatus in bbbStati if bbbStatus.pointOfTime >= monthBeforeEnd]
+
image: Path = doPlotMeetings(bbbStati)
print("saved image at " + str(image))
def doPlotMeetings(bbbStati: List[BbbStatus]) -> Path:
+ '''
+ :param bbbStati: List of bbbStatus objects sorted by date
+ '''
+
time = [] # x-axis: time
participants = [] # yAxis (1)
videos = [] # yAxis (2)
@@ -56,8 +73,8 @@ def doPlotMeetings(bbbStati: List[BbbStatus]) -> Path:
ax.plot(time, voices, label='voice')
# format the ticks (on x-axis)
- days = mdates.DayLocator()
- hours = mdates.HourLocator(interval=6) # every 6 hours one minor tick
+ days = mdates.DayLocator(interval=2) # every second days
+ hours = mdates.HourLocator(interval=12) # every 12 hours one minor tick
dateFmt = mdates.DateFormatter('%Y-%m-%d')
ax.xaxis.set_major_locator(days)