diff --git a/README.md b/README.md index 2333913..aa108f6 100644 --- a/README.md +++ b/README.md @@ -8,32 +8,32 @@ - [110860 André Jesus](https://github.com/andre-j3sus) - [110893 Nyckollas Brandão](https://github.com/Nyckoka) -Professor: João Garcia +Professors: João Coelho Garcia and David Rogério Póvoa de Matos @IST
Master in Computer Science and Computer Engineering
Mobile and Ubiquitous Computing - Group 03
Summer Semester of 2023/2024 -## Table of Contents 📜 +## Table of Contents -- [Architecture 🏗️](#architecture-️) +- [Architecture](#architecture-) - [Backend](#backend) - [Frontend](#frontend) -- [How to Run ▶️](#how-to-run) - - +- [How to Run](#how-to-run) --- -## Architecture 🏗️ +## Architecture ### Backend The backend code is located in the [`src/backend`](./src/backend) directory. -The backend is a **REST API** built using **[Spring Boot](https://spring.io/projects/spring-boot)** and -**[Kotlin](https://kotlinlang.org/)**. It is responsible for managing the data and the business logic of the +The backend is a **REST API** built using **[Spring Boot](https://spring.io/projects/spring-boot)** +and +**[Kotlin](https://kotlinlang.org/)**. It is responsible for managing the data and the business +logic of the application. It's implemented following the **layered architecture** pattern, with the following layers: @@ -42,50 +42,65 @@ It's implemented following the **layered architecture** pattern, with the follow - **Service**: responsible for the business logic of the application. - **Repository**: responsible for managing the data. -For simplicity, the backend uses an **in-memory database** to store the data. This means that the data is not persisted -between runs of the application. A future improvement could be to use a **relational database** to store the data. +For simplicity, the backend uses an **in-memory database** to store the data. This means that the +data is not persisted +between runs of the application. A future improvement could be to use a **relational database** to +store the data. ### Frontend The frontend code is located in the [`src/frontend`](./src/frontend) directory. -The frontend is a **mobile application** for **Android** built using **[Kotlin](https://kotlinlang.org/)** and +The frontend is a **mobile application** for **Android** built using * +*[Kotlin](https://kotlinlang.org/)** and **[Jetpack Compose](https://developer.android.com/develop/ui/compose)**. It is responsible for providing a user interface for the application. The frontend code is organized as follows: -- [Domain](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/domain): contains the domain models of the +- [Domain](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/domain): contains the domain + models of the application. -- [Service](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/service): contains the service classes that +- [Service](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/service): contains the + service classes that interact with the backend. -- [Session](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/session): contains the session classes that +- [Session](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/session): contains the + session classes that manage the user session. -- [UI](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/ui): contains the UI components of the application. - - [Screens](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/ui/screens): contains the screens of the +- [UI](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/ui): contains the UI components of + the application. + - [Screens](src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/ui/screens): contains the + screens of the application, where each screen is implemented using a: - **Screen.kt**: the screen composable. - - **ViewModel.kt**: the view model of the screen, responsible for managing the screen's state. + - **ViewModel.kt**: the view model of the screen, responsible for managing the + screen's state. - **Activity.kt**: the activity that hosts the screen. --- -## How to Run ▶️ +## How to Run To run the project, follow these steps: -1. Clone the repository: +1. Clone the repository or download the source code; + +2. Run the **Docker Compose** command in the `src/backend` directory to start the server: ```bash -git clone +cd src/backend +docker-compose up ``` -2. Run the **Docker Compose** command in the `src/backend` directory to start the server: +**Note:** if you do not have Docker installed, you can run the backend server using the following command: ```bash cd src/backend -docker-compose up +gradlew clean build +gradlew bootRun ``` -3. Open the frontend project in **Android Studio** and run the application on an **Android Emulator** or a **Physical - Device**. +In any of the cases, the server will be running on `http://localhost:8080`. + +3. Open the frontend project in **Android Studio** and run the application on an + **Android Emulator** or a **Physical Device**. diff --git a/src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/ui/screens/pharmacy/components/PharmacyRating.kt b/src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/ui/screens/pharmacy/components/PharmacyRating.kt index 310375e..15f7575 100644 --- a/src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/ui/screens/pharmacy/components/PharmacyRating.kt +++ b/src/frontend/app/src/main/kotlin/pt/ulisboa/ist/pharmacist/ui/screens/pharmacy/components/PharmacyRating.kt @@ -56,8 +56,8 @@ fun PharmacyRating( // Global Rating Row { - Text( - text = "${pharmacy.pharmacy.globalRating ?: 0}", + Text(// only with one decimal + text = "${pharmacy.pharmacy.globalRating?.let { String.format("%.1f", it) } ?: 0}", style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center, fontSize = 40.sp,