From bc52d4f929f83d3e8e43034a0955b74855ee9daa Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Tue, 10 Jul 2018 15:19:24 +0200 Subject: [PATCH] Add 2 new report types: accident + misc. Fix #15. --- README.md | 6 +- scripts/purge_old_gcum.py | 4 +- src/assets/accident.svg | 160 ++++++++++++++++++++++++++ src/assets/accidentMarker.svg | 131 +++++++++++++++++++++ src/assets/gcumMarker.svg | 8 +- src/assets/interruptMarker.svg | 12 +- src/assets/misc.svg | 99 ++++++++++++++++ src/assets/miscMarker.svg | 62 ++++++++++ src/assets/obstacleMarker.svg | 29 ++++- src/assets/potholeMarker.svg | 90 +++++++++++---- src/components/About.vue | 2 + src/components/ReportDialog/index.vue | 5 +- src/constants.js | 39 ++++++- src/i18n/en.js | 4 + src/i18n/fr.js | 4 + 15 files changed, 610 insertions(+), 45 deletions(-) create mode 100644 src/assets/accident.svg create mode 100644 src/assets/accidentMarker.svg create mode 100644 src/assets/misc.svg create mode 100644 src/assets/miscMarker.svg diff --git a/README.md b/README.md index a597071..4ca0ef4 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,8 @@ the server side part. The `scripts` folder contain some useful scripts: -* `purge_old_gcum.py` deletes `gcum`-type report older than one hour. You - should set a crontask to call it regularly. +* `purge_old_gcum_and_accidents.py` deletes `gcum` and `accident` type report + older than one hour. You should set a crontask to call it regularly. ## Contributing @@ -121,3 +121,5 @@ Icons are made from the original works: were designed by Vecteezy. * [Trash icon](https://pixabay.com/en/trash-waste-trashcan-garbage-99257/) is coming from Pixabay under CC0 license. +* [Accident icon](https://www.flaticon.com/free-icon/car-running-over-a-bicycle_91680) is + coming from Flaticon. diff --git a/scripts/purge_old_gcum.py b/scripts/purge_old_gcum.py index f8275d7..e611d79 100644 --- a/scripts/purge_old_gcum.py +++ b/scripts/purge_old_gcum.py @@ -13,9 +13,9 @@ if __name__ == "__main__": db.connect() one_hour_ago = arrow.utcnow().shift(hours=-1).datetime nb = Report.delete().where( - (Report.type == 'gcum') & + ((Report.type == 'accident') | (Report.type == 'gcum')) & (Report.datetime < one_hour_ago) ).execute() - print("%d GCUM reports purged." % nb) + print("%d accident/GCUM reports purged." % nb) if not db.is_closed(): db.close() diff --git a/src/assets/accident.svg b/src/assets/accident.svg new file mode 100644 index 0000000..65cc4eb --- /dev/null +++ b/src/assets/accident.svg @@ -0,0 +1,160 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/accidentMarker.svg b/src/assets/accidentMarker.svg new file mode 100644 index 0000000..f72de51 --- /dev/null +++ b/src/assets/accidentMarker.svg @@ -0,0 +1,131 @@ + +image/svg+xml \ No newline at end of file diff --git a/src/assets/gcumMarker.svg b/src/assets/gcumMarker.svg index 4b256cd..ed2ccc3 100644 --- a/src/assets/gcumMarker.svg +++ b/src/assets/gcumMarker.svg @@ -26,12 +26,12 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1923" - inkscape:window-height="1041" + inkscape:window-width="1920" + inkscape:window-height="1036" id="namedview4165" showgrid="false" inkscape:zoom="8" - inkscape:cx="15.324518" + inkscape:cx="-9.800482" inkscape:cy="34.227055" inkscape:window-x="0" inkscape:window-y="0" @@ -74,7 +74,7 @@ id="g4175" style="fill:#ffffff;stroke:#000000;stroke-opacity:1" transform="matrix(1.1140552,0,0,1.1140552,-3.3978567,-6.8738791)">image/svg+xml + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + ? + + + diff --git a/src/assets/miscMarker.svg b/src/assets/miscMarker.svg new file mode 100644 index 0000000..b99604c --- /dev/null +++ b/src/assets/miscMarker.svg @@ -0,0 +1,62 @@ + +image/svg+xml \ No newline at end of file diff --git a/src/assets/obstacleMarker.svg b/src/assets/obstacleMarker.svg index 3160200..ef9ad22 100644 --- a/src/assets/obstacleMarker.svg +++ b/src/assets/obstacleMarker.svg @@ -6,6 +6,8 @@ xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xml:space="preserve" viewBox="0 0 64.000001 64" height="64" @@ -13,10 +15,31 @@ y="0px" x="0px" id="Layer_1" - version="1.1">image/svg+xmlimage/svg+xml \ No newline at end of file diff --git a/src/components/About.vue b/src/components/About.vue index 250ebb2..8860681 100644 --- a/src/components/About.vue +++ b/src/components/About.vue @@ -9,10 +9,12 @@

{{ $t('about.availableReportsTitle') }}

    +
  • {{ $t('reportLabels.accident') }}{{ $t('misc.spaceBeforeDoublePunctuations') }}: {{ $t('reportLabels.accidentDescription') }}
  • {{ $t('reportLabels.gcum') }}{{ $t('misc.spaceBeforeDoublePunctuations') }}: {{ $t('reportLabels.gcumDescription') }}
  • {{ $t('reportLabels.interrupt') }}{{ $t('misc.spaceBeforeDoublePunctuations') }}: {{ $t('reportLabels.interruptDescription') }}
  • {{ $t('reportLabels.obstacle') }}{{ $t('misc.spaceBeforeDoublePunctuations') }}: {{ $t('reportLabels.obstacleDescription') }}
  • {{ $t('reportLabels.pothole') }}{{ $t('misc.spaceBeforeDoublePunctuations') }}: {{ $t('reportLabels.potholeDescription') }}
  • +
  • {{ $t('reportLabels.misc') }}{{ $t('misc.spaceBeforeDoublePunctuations') }}: {{ $t('reportLabels.miscDescription') }}

diff --git a/src/components/ReportDialog/index.vue b/src/components/ReportDialog/index.vue index 651abf2..082412d 100644 --- a/src/components/ReportDialog/index.vue +++ b/src/components/ReportDialog/index.vue @@ -26,7 +26,7 @@ - + @@ -35,7 +35,7 @@