Giter Site home page Giter Site logo

passbuy's Introduction

sc_badge_1 sc_badge_2 sc_badge_3

Built by a team of students for a school project, PassBuy enables the user to find the cheapest price for his shopping list in quick and easy steps.

Running the application

To run it locally you need to have a key for the Google Places API.

Back-end

In the back-end subfolder lies content for both the database and the NodeJS API. Instructions for running or using the API can be found there as well.

Front-end

Similarly, the front-end subfolder contains the Android Studio project for our application as well as an Adobe XD project file for the application's design.

Utility Scripts

The small-scale scripts that were used, in the early stages of our application, to gather and analyze data are located in the Utility Scripts subfolder.

Contributors - The Team

Μιχάλης Γεωργιάδης

Θοδωρής Παπακωνσταντίνου

Κωνσταντίνος Φράγκος

Διονύσης Σάρρος

Αλτίον Μάλκα

Χρήστος Τσιτσιρίγκας

Πασχάλης Φλώρος

Δημήτρης Χαντές

Παντελής Φιλίππου

Χρήστος Μήλιος

Δημήτρης Τσιμπιτάς

passbuy's People

Contributors

alvincein avatar dioextreme avatar iamaldi avatar tsimpdim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

passbuy's Issues

Implementing use of arrow functions - ES6

We can easily replace current function written in this form, function foo(bar){} with ES6's arrow functions, (bar){} since there is not much functionality we are dumping in each of our functions.

The code shall be more readable and implement the latest features of ES6

Algorithm for finding lowest basket price - A proposal

This issue covers initial thoughts on how to find the best combination of prices along different supermarkets given a Product list.

Let us begin with a simple list containing 3 products.
Each product, for simplicity reasons on this example will have only:
name prices

Our list of products shall contain the following:

[{
	"name": "Natural Mineral Water",
	"prices": [{
		"store_id": 1,
		"price": 1.20
	}, {
		"store_id": 2,
		"price": 1.18
	}, {
		"store_id": 3,
		"price": 0.95
	}, {
		"store_id": 4,
		"price": 1.10
	}]
},
{
	"name": "Lacta Chocolate",
	"prices": [{
		"store_id": 1,
		"price": 1.35
	}, {
		"store_id": 2,
		"price": 1.50
	}, {
		"store_id": 3,
		"price": 1.20
	}, {
		"store_id": 4,
		"price": 1.49
	}]
},
{
	"name": "DELTA Fresh Milk 1.5LT",
	"prices": [{
		"store_id": 1,
		"price": 0.88
	}, {
		"store_id": 2,
		"price": 1.10
	}, {
		"store_id": 3,
		"price": 0.95
	}, {
		"store_id": 4,
		"price": 1.25
	}]
}]

The algorithm starts by iterating through each product and finding the lowest price of it.
The store that had the lowest receives a bonus.

So for instance, on the first product, store with id 3 has the lowest price. So it receives a bonus.
For now we have the following statistics on the store bonuses:
Store 1 bonus = 0
Store 2 bonus = 0
Store 3 bonus = 1
Store 4 bonus = 0

Next product is iterated, and lowest price is found on store with id 3. That store gets a bonus.
Last, but not least, we have the following statistics on the store bonuses:
Store 1 bonus = 0
Store 2 bonus = 0
Store 3 bonus = 2
Store 4 bonus = 0

Last product on this example is iterated, lowest price is found on store with id 1. That store gets a bonus.
Finally, we have the following statistics on the store bonuses:
Store 1 bonus = 1
Store 2 bonus = 0
Store 3 bonus = 2
Store 4 bonus = 0

At the end of the iteration, find the store that has the received the biggest bonus.

TO-DO
Calculate the final price * quantity of a product before finding the lowest price of that on each store.
Though, this can be done after calculating the lowest total of the whole basket.

What I mean by that?

First find which store offers the lowest overall prices of the basket products. Then, after having found that, calculate the quantity * price of each product and return the results.

Set default activity to HomeScreen

The default activity should be set to HomeScreen.

AndroidManifest.xml should contain the following code to declare HomeScreen as the default activity of the application.

        <activity android:name=".HomeScreen" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

This shall be a future enhancement as the activities are not currently linked together. ;-)

Fix .gitignore

Το api/db_creds.json πρεπει να αλλαξει αφου δεν ειναι πλεον το ονομα του αρχειο σε api/db_conf.json

Change PassBuy_API folder name to api

As I suggested the back-end to serve all endpoints from an /api/ path ( #22 ) it would be a good practice to also rename the folder that the back-end application lies on, from PassBuy-API to api.

Disable landscape mode on all views/intents

If you rotate the smartphone in landscape mode (horizontally), all the icons reorganize and make up a mess on the user's screen.
I think we should disable the rotation ability since we do not intend to make our app work horizontally (landscape), but only vertically(portrait).

A solution points to stackoverflow.com

<activity android:name=".SomeActivity" android:label="@string/app_name" android:screenOrientation="portrait" />

Please, I would suggest that you also take into consideration the various caveats suggested by the author of the solution on stackoverflow.com

Serve endpoints from /api/ path on back-end

I would suggest having the back-end serving all the endpoints from the /api/ path.
Example:
/api/products/1
/api/prices/12
/api/prices/12/1
/api/stores etc.

Instead of simple
/products/1

The /api/ path shall indicate that the back-end is serving API endpoints.

ERROR PATATAKIA NOT FOUND.

δεν βρισκω πουθενα τα πατατακια στην εφαρμογη, εχω τρελαθει...

Some times app crashes at Launch cause of bestsupermarket value

Στο home screen, οταν καλουμε το Thread για να παρουμε τα stores, στο τελος τοποθετείται το ονομα του καλυτερου μαγαζιου στο πεδιο best_supermarket στο UI. Το κακο ειναι οτι μερικες φορες crusharei εξαιτιας του η εφαρμογη οταν την ανοιγεις και μερικες φορες οχι. Στην ουσια δεν ολοκληρωνεται το thread.

Better error handling on API routes

Το

    if(err) throw err;

δεν επιτρέπει στον χρήστη του API να ξέρει ότι κάτι πήγε στραβά. Μια πιθανή λύση είναι το χτίσιμο ενός JSON αντικειμένου το οποίο θα λέει στον χρήστη ότι το αίτημα του δεν υλοποιήθηκε.

Find best basket price across different stores

Given a list of products in a JSON object:

[
	{
		"name": "ΦΥΣΙΚΟ ΜΕΤΑΛΛΙΚΟ ΝΕΡΟ  6 X 1,5 LT",
		"description": "Το Ανώτερης ποιότητας Φυσικό Μεταλλικό Νερό ΚΟΡΠΗ, χάρη στη μοναδική του σύνθεση σε μέταλλα, καλύπτει τις ανάγκες του οργανισμού για υγιεινή ενυδάτωση και σας προσφέρει ξεχωριστή ζωντάνια και ευεξία.",
		"image_url": "https://www.ab.gr/medias/sys_master/h09/hf8/8918686662686.jpg",
		"category": 1,
		"product_id": 1,
		"prices": [
			{
				"store_id": 1,
				"price": 1.99
			},
			{
				"store_id": 2,
				"price": 1.81
			},
			{
				"store_id": 3,
				"price": 1.09
			},
			{
				"store_id": 4,
				"price": 2.47
			}
		]
	},
	{
		"name": "ΑΝΑΨΥΚΤΙΚΟ ΚΟΥΤΙ 6 X 330 ML",
		"description": "Γιατί η ζωή έχει τη γεύση που της δίνεις! Ξεχωριστή απόλαυση και ανάλαφρη γεύση με λιγότερο από 1 θερμίδα.  H Coca-Cola light είναι ένα αναψυκτικό χωρίς ζάχαρη, που παρέχει λιγότερο από1 θερμίδα σε κάθε ποτήρι 250ml ή σε κάθε κουτάκι 330ml. Η ζάχαρη έχει αντικατασταθεί από γλυκαντικές ουσίες, όπως η ασπαρτάμη, η ακεσουλφάμη-Κ και το κυκλαμικό οξύ, οι οποίες είναι απολύτως ασφαλείς και αποδίδουν πρακτικά μηδενικές θερμίδες.",
		"image_url": "https://www.ab.gr/medias/sys_master/hd6/h08/8890363838494.jpg",
		"category": 1,
		"product_id": 2,
		"prices": [
			{
				"store_id": 1,
				"price": 3.14
			},
			{
				"store_id": 2,
				"price": 3.42
			},
			{
				"store_id": 3,
				"price": 3.9
			},
			{
				"store_id": 4,
				"price": 3.69
			}
		]
	}
]

calculate the best total basket price given each product price at different stores.

Some routes return a JSON array when there is meant to be only one result

Συγκεκριμένα τώρα που τα βλέπω

• /categories/id
• /prices/id/id

Δηλαδή άμα καλέσουμε /categories/2 παίρνουμε :

[
   {
      "name":"Γαλακτοκομικά",
      "category_id":2
   }
]

αντί για :

{
   "name":"Γαλακτοκομικά",
   "category_id":2
}

Create the appropriate API routes as specified in the SRS

  • /products

  • /products/<int:product_id>

  • /products/beverages

  • /products/dairy

  • /products/delicatessen

  • /products/frozen

  • /products/fruits_veggies

  • /products/snacks

  • /products/health_beauty

  • /products/home

  • /products/meat_fish

  • /products/misc

  • /categories

  • /categories/<int:category_id>

  • /prices/<int:product_id>

  • /prices/<int:product_id>/<int:store_id>

  • /stores

Allow for product search through the existing endpoints

Στο endpoint /products/arg αν το arg είναι string και δεν ταιριάζει με καμία κατηγορία (δηλαδή το αντίστοιχο αίτημα sql παρουσιάζει σφάλμα) τότε μπορούμε να θεωρήσουμε ότι το arg είναι κάποιο keyword με το οποίο μπορούμε να κάνουμε αναζήτηση

Ticks on "SearchResults" dont work properly.

Οταν προσθετεις ενα προιον στο καλαθι σου ή υπαρχει ηδη, το "add button" γινεται τικαρισμενο. Το προβλημα ειναι οτι υπαρχει ενα bug και επαναλαμβανεται το tick και σε προιοντα που δεν εχεις βαλει στο καλαθι.

Passing data between Activities

Θέλουμε το αντικείμενο basket να το παίρνουμε μαζί μας σε κάθε activity που αλλάζουμε.
1ος Τρόπος: Κάνουμε το αντικείμενο Serializable και το περνάμε με Bundle.
2ος Τρόπος: Κάνουμε στατική κλάσση που έχει πάντα μέσα της το Basket. (Singleton)
3ος Τρόπος: Δημιουργούμε μέθοδο μέσα στην κλάσση Basket και το κάνουμε Parcelable και το περνάμε με Bundle.
Και οι τρεις είναι σχετικά δύσκολοι στην υλοποίηση.
Άμα βρείτε καλύτερο τρόπο, δεκτός.

Optimize data retrieval from the API

The first version of the code had all data retrieval being done in the main thread causing the UI to freeze until the API call was finished. This would obviously ruin the user's experience on slow connections.

The second version had the data being retrieved asynchronously but it had the limitation that we could only make one kind of call per activity. This could cause issues in the activities' implementations.

The current version in the test branch runs the first version in a new thread. This prevents the UI from freezing without the limitations of the second version. It's currently unknown if there are any issues involved with this method.

Have the user's basket be stored locally

Κριμα δεν ειναι να χανει ο χρηστης τα προιοντα που ειχε στο καλαθι του αν κλεισει η εφαρμογη; 😢

Server crashing due to un-handled error?!

The server log contains an error message:

^Bevents.js:183
      throw er; // Unhandled 'error' event
      ^

Error: Connection lost: The server closed the connection.
    at Protocol.end (/home/redacted/the-dream-team/back-end/api/node_modules/mysql/lib/protocol/Protocol.js:113:13)
    at Socket.<anonymous> (/home/redacted/the-dream-team/back-end/api/node_modules/mysql/lib/Connection.js:109:28)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Notice the throw er; error. Looks like a typo somewhere in the code.

Improve More-Info and Popup

Currently in the 2 layouts:

  • The Roboto font is missing
  • A TextView in more_info_recycler has incorrect constraints
  • The buttons in Popup have incorrect backgrounds

Create the base UI for the search button landing page

Δε ξερω γιατι γραφω τα μισα αγγλικα και τα υπολοιπα ελληνικα.

Eitherway, αναφερομαι στο σκριν με τη μπαρα αναζητησης και την λιστα με τις κατηγοριες

Implement search for the closest stores

Με το API ειτε του Google Maps ειτε του Google Places πρεπει να βρισκουμε τις κοντινοτερες τοποθεσειες των (τεσσαρων) καταστηματων που εχουμε στη βαση.

Fix more-info layout

Currently in the layout:

  • It is possible that the basket info button goes off position on high DPI screens.
  • The attribute scaleType is being used on components where it does nothing.

SearchResults, text field inside search box is scrollable

On the SearchResults activity, inside the search box, if you try to scroll the text inside the box you will notice that the text is indeed scroll-able.

For a better user experience I would suggest making the whole text area inside the search box unscroll-able to improve user experience.

Improve API responses

Καποια πεδια οχι μονο δεν χρειαζονται να υπαρχουν αλλα και κανουν πιο δυσκολη την προσπελαση τους απο την κυρια εφαρμογη.

  • Αφαιρεση του πεδιου "category_id" απο το route "/products/<str:categ>"

  • Αφαιρεση του πεδιου "product_id" απο το route "/prices/<int:product_id>"

  • Καθαρισμα του κωδικα οσο γινεται

  • Ανανεωση του readme.md

  • Ανανεωση του server

Create base UI for the "Basket Info" screen

Η οθονη στην οποια υπαρχουν για το συγκεκριμενο καταστημα το καθε προιον μαζι με τα επιλεγμενα τεμαχια και την τιμη τους

Database Connection Pools

Implement Database Connection Pools in order to issue database queries on-demand instead of having the service up all the time. This will resolve the issue of the server crashing when connection with the database is lost (#38 ).

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.