Code Monkey home page Code Monkey logo

greve-transportes-perigosos's People

Contributors

abreulima avatar claudiovarandas avatar gadelhas avatar joao avatar miguelantoniosantos avatar tomahock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

greve-transportes-perigosos's Issues

[Feat] jump to update (ajudar) directly from "consultar"

When looking at the "consultar" map, it would be nice to be able to jump directly to the "ajuda", to the same fuel station, to contribute to update the status of the fuel station.

The two screens are slightly different, with the "consultar" more efficient to search for stuff, as the "ajudar" is not that clear on the brand of the station, making it quite hard, specially on a mobile, to look for a station, then have to go back to the beginning, ajudar, and search again for the same station.

[Feature] Add risk level from ENSE

Add information about fuel supply risk from ENSE (national energy sector regulator).

I don't know if there is any available API to gather this info, but in their website the information is available in line 692 of the HTML source code.

[Feat] Differentiate the validation criteria by location

Context
To submit an update about a Fuel Station, we evaluate that there are enough entries submitted from standard users. The amount of entries needed is configured through an admin panel.

Problem
Some reports indicate that in some locations, the information would not update due to the lack of submissions. This happens mostly because there are some locations that don't have enough people using the website to report, so we have to evaluate this information manually or reduce the number of entries needed and creating another problem in other locations.

Objective

  1. Create a set of polygons with "My Google Maps" that separates geographically locations that should have a different amount of entries evaluated and describe them with the number of entries needed.

  2. Add an integer column "num_entries" in the fuel station's table to identify how many entries each station needs

  3. Create a script that verifies all the fuel stations without "num_entries", checks which polygon feats the geographical position and fills the "num_entries" column with the given number of that polygon.

  4. Feat the submission method of the map to validate the number of entries with "num_entries" of each station

[Feat] Updated with relative time period

If it makes sense to you, relative time periods are more helpful to understand "last updated", rather than full dates, as in this case the idea is to see how stale the information is.

So here's a suggestion for a quick timediff:

diff --git a/resources/js/map.js b/resources/js/map.js
index cd4a100..210a8dd 100644
--- a/resources/js/map.js
+++ b/resources/js/map.js
@@ -28,6 +28,19 @@ String.prototype.capitalize = function () {
     });
 };
 
+function timediff(date) {
+    let diffSeconds = Math.floor((new Date() - date) / 1000);
+    let days = Math.floor(diffSeconds / 86400);
+    let hours = Math.floor((diffSeconds % 86400) / 3600);
+    // ceil because we don't care about seconds
+    let minutes = Math.min(59, Math.ceil((diffSeconds % 3600) / 60));
+    var res = ""
+    if (res || days > 0) { res += " " + days + "d"; }
+    if (res || hours > 0) { res += " " + hours + "h"; }
+    if (res || minutes > 0) { res += " " + minutes + "m"; }
+    return res.trim();
+}
+
 function loadPoints() {
     return new Promise(function (resolve, reject) {
         points = [];
@@ -131,9 +144,11 @@ function loadPoints() {
                 else {
                     tooltip += '<p style="margin-bottom:0">Marca: '+ fuelStation.brand +'</p>';
                 }
-                var date = new Date(fuelStation.updated_at.replace(/ /, 'T') + '+01:00');
+                let date = new Date(fuelStation.updated_at.replace(/ /, 'T') + '+01:00');
+                // let dateString = date.toLocaleString();
+                let dateString = timediff(date);
                 tooltip += '<p style="margin-bottom:0">ID: '+fuelStation.id+'</p>';
-                tooltip += '<p style="margin-bottom:0">Última atualização em: '+date.toLocaleString()+'</p>';
+                tooltip += '<p style="margin-bottom:0">Última atualização: '+dateString+'</p>';
                 points.push({
                     "type": "Feature",
                     "geometry": {

[Feature] Gas Stations

Wrong SEO of "Ja nao da para abastecer"

If I search for "Ja nao da para abastecer"

It gives me this message that the strike is over:
https://imgur.com/a/5Spk4YY

or even:

"Após a desconvocação da greve, a nossa missão chegou ao fim. Obrigado a todos os que contribuíram com informação válida, que tantas pessoas ajudou. Obrigado a todos os que contribuíram com informação inválida, que tanto nos ajudou a aprender e a crescer. Ficam aqui os números, que falam por si. Site"

[Feat] Validate standard user location on fuel data submission

Context
One of the biggest problems is the integrity of the data. We have seen some invalid submissions happen.

Problem
A standard user can submit fuel information for any fuel station disregarding his location.

Objective

  1. User must share his location to participate
  2. Send the user location when he submits data about a fuel station
  3. Calculate the distance between the user position and the fuel station's position. If it's in a radius of X km accepts the entry. If not, retrieves an error to the interface.

[Feat] [Important] Get data from ENSE

Context
ENSE is the official entity in Portugal.
As far as we know they are getting information every day in the morning and in the afternoon.
On this website they have information regarding the REPA network

Problem
ENSE will not share their data in an open format. The way that the information is presented is not user friendly

Objective

  1. Create a script that fetches data (scrapes it) from the official website and updates the REPA stations twice a day on the website "Já Não Dá Para Abastecer"
  2. Send updated information, via @vostpt/bot, to Discord Channel ID 608766585309626368

[Feat] UI Enhancements

Based on feedback from users:

  • Add tooltip on pump Icons with "Gasolina", "Gasóleo", and "GPL" (color blind enhancement)
  • Add #ID on tooltip when mouse hover the fuel station icon

Safari is picky with new Date() and no timezones (from #134)

Safari does not like ISO dates without timezones, so the recent "last updated" is broken.

This would be a quick hack that will assume the dates coming from the backend are WEST. Dates shall always be either UNIX timestamps, when after 1970, or full ISO 8601 dates, including timestamps.

Also, localization wise, we don't Capitalize Every Word in Portuguese ;)

diff --git a/resources/js/map.js b/resources/js/map.js
index 2ac903b..cd4a100 100644
--- a/resources/js/map.js
+++ b/resources/js/map.js
@@ -131,9 +131,9 @@ function loadPoints() {
                 else {
                     tooltip += '<p style="margin-bottom:0">Marca: '+ fuelStation.brand +'</p>';
                 }
-                var date = new Date(fuelStation.updated_at);
+                var date = new Date(fuelStation.updated_at.replace(/ /, 'T') + '+01:00');
                 tooltip += '<p style="margin-bottom:0">ID: '+fuelStation.id+'</p>';
-                tooltip += '<p style="margin-bottom:0">Última Atualização em: '+date.toLocaleString()+'</p>';
+                tooltip += '<p style="margin-bottom:0">Última atualização em: '+date.toLocaleString()+'</p>';
                 points.push({
                     "type": "Feature",
                     "geometry": {
@@ -193,7 +193,7 @@ function getAttributions() {
     var minutes = date.getMinutes();
     var hour = date.getHours();
     let attributions = [...customAttributions];
-    attributions.push('Última Atualização às: ' + ("0" + hour).slice(-2) + 'h' + ("0" + minutes).slice(-2) + 'm' + ("0" + seconds).slice(-2) + 's');
+    attributions.push('Última atualização às: ' + ("0" + hour).slice(-2) + 'h' + ("0" + minutes).slice(-2) + 'm' + ("0" + seconds).slice(-2) + 's');
     return attributions;
 }
 

[Feat] Count searches by brand & produce graphic

Statistics, statistics, statistics! We want data!

  • Think of a way to store search strings by brand
  • Program it
  • Test it
  • create hourly line and bar graphic to be available on brand's BO
  • Insert on each brand's BO

[Feat] Statistics by Brand

Context:

Prio is now providing official data and information to the platform.

On the statistics page display a bar graphic just for PRIO below general availability's bars using #3D8FAA for available. Name "PRIO" and linking to PRIO's homepage https://www.prio.pt/pt/postos/rede-de-postos_289.html?tab=1&type=1

[Feat] Show "last updated"

On "Consultar", it would be nice to see the time of the last-updated so we know how state is the information of the status of a fuel station.

there seems to be timestamps on the DB, and on app/Http/Controllers/CacheController.php it should be possible to write the updated timestamp on the cache.JSON file, on the line
$json = FuelStation::all('id', 'name', 'brand', 'long', 'lat', 'repa', 'sell_gasoline', 'sell_diesel', 'sell_lpg', 'has_gasoline', 'has_diesel', 'has_lpg')->toJson();
and then adapt the html+javascript to show the date on the box of the fuel station status

[Feat] [Bug] Stop scrolling and zooming out when clicking icons; etc.

When we are zoomed in in the map and click an icon we are zoomed out automagically, which is annoying.

When clicking an icon the popup info window is huge!
Can you make this smaller and add clear information about available fuels? Pricing would be nice too.

In mobile devices, which the majority of accesses come from I believe, the site has some issues.
When scrolling, the whole page scrolls instead of the map.
The legend gets behind the search field...

[Feat] New Dashboard as iFrame

INCLUDE IN MEDIA
Dashboard Code
<style>.embed-container {position: relative; padding-bottom: 80%; height: 0; max-width: 100%;} .embed-container iframe, .embed-container object, .embed-container iframe{position: absolute; top: 0; left: 0; width: 100%; height: 100%;} small{position: absolute; z-index: 40; bottom: 0; margin-bottom: -15px;}</style><div class="embed-container"><iframe width="500" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" title="BASEMAP" src="https://arcgis.com/apps/opsdashboard/index.html#/a4890bfd60df4c07bd67c857b73b452f"></iframe></div>

Dashboard Description
Uma dashboard em tempo real dos dados recolhidos no site "Já Não Dá Para Abastecer", feita em ArcGIS com o apoio da ESRI Portugal.
Termos e condições de uso:Full Credits a VOSTPT / Esri Portugal / ArcGis

Exemplo Dashboard
Screenshot 2019-08-14 at 11 42 51

CREATE NEW MENU ITEM "MORE STATS"*
Embed above code on website

[Feat] Submissions per hour

Implement a method to calculate total submissions + submissions per hour to be shown in a line graph within the Dashboard and main page.
Implement a method to calculate number of reported fuel stations without Gasolina / Gasóleo / GPL per hour to be shown in three different line graphs on the dashboard and main page.

Graphs should be made available as an iFrame as well

[Feat] Enhanced Tooltip

On mouse over return:

  • Fuel Station Name
  • Type (Normal, REPA, REPA SOS)
  • Status
    If the fuel station is "PRIO"
  • Insert link to https://www.prio.pt/pt/postos/rede-de-postos_289.html?tab=1&type=1

[Feat] Hourly Evolution

Get hourly variations and generate a hourly graph as in the example
EVOLUÇÃO HORÁRIA (1)

Graph should be within an iframe with a vertical scroll

[Feat] New source by URL

Fetch information from the shared source maintained by Waze to allow quick edits by VOST Portugal's team.

This information will be consolidated with Waze at a later date.

This feature has high priority

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.