Talently Challenge
Configuration
This repository includes the initial configuration for this problem, including the SPECS. Use the Kahlan bookstore, which you probably haven't used. But don't worry, there is not much to learn. Check the SPECS and you will understand the basic syntax in less than a minute.
Your task is:
- Refactor the code in the
VillaPeruana.php class. - Add a new element typo, "coffee." The specifications for this element are commented on in the
VillaPeruanaScpec.php file.
Flow
You must have Docker installed on your computer to use our workflow commands
- Use the
./start command to initialize the docker - Use the
./test command to run the tests - Use the
./finish command to deactivate the docker
Rules
Hello and welcome to the Peruvian village. As you know, we are a small inn, with an excellent location in an important city, administered by our friendly Allison. We also buy and sell the finest products. Unfortunately, our products are constantly unfortunate in quality as they approach their expiration date. We have a system that updates our inventory for us. It was developed by a developer named Elmo, who has gone in search of new adventures.
We want to add a new category of products to the system and for this we need your help.
First, an introduction to our system:
- All products have a sllay that denotes the number of days to sell the product
- All products have a Quality that denotes how valuable it is the product
- At the end of each day, our system decreases both values for each product
Quite simple, right? Well, here becomes interesting:
- When the sale date has passed, the Quality degrades twice faster
- The Quality of a product is never negative
- The "Pisco Peruano" products actually increase in Quality the older they are
- The Quality of a product is never greater than 50
- "Tumi" products, being a legendary product, should never be sold or low
- The "VIP Tickets", as well as "Peruvian Pisco", increase their Quality according to their Sellin approaches 0, the Quality increases by 2 when 10 days or less are missing and in 3 when 5 days or less are missing, but the Quality decreases to 0 after the concert.
Recently we have signed a contract with a "coffee" product supplier. This requires an update for our system:
- "Coffee" products degrade in Quality twice as normal products
To make it clear, a product can never increase its Quality greater than 50, however "Tumi" is a legendary product and as such its Quality is 80 and never changes.
Deliverable or expectation of the challenge
- The cleaning and readability of the code will be considered.
- The efficiency of the code in performance matters will add for this test.
- It will be indispensable use of solid principles
- At the end of the challenge, send the solution of the solution to [email protected] with copy to [email protected] with title "challenge talently backend"
Knowledge questions in Laravel
What package or strategy would you use to raise an administration system quickly? (Authentication and cruds)
- A: There are several units, which can be installed jointly with a new Laravel project, others are installed as additional dependencies. For me the best option is to use Laravel Breeze with Blade, since it comes by default. Now if you want to use a Bootstrap Legacy, you can use the dependence of Laravel/UI with the Bootstrap Stack.
A brief explanation of how Laravel uses the injection of dependencies
- A: The injection of dependencies is in charge of instantizing the classes we need and supply ("inject") the dependencies by sending the appropriate parameters to the builder. It complies with one of the solid prlicios, which refers to the investment of dependencies (DI) and avoids the Rigid dependence Ente components.
In what cases would you use a query scope?
- A: The use of a Query Scope will depend on the scope in the consultation, since Laravel can implement 2 types of Query Scope, local and global. If we use a global query scope, it would allow a consultation to be applied any model that is needed. On the other hand, the Local Query Scope is created as a method within the model that requires it.
What conventions do you use in the creation and implementation of migrations?
- A: According to PSR conventions for PHP programming, Laravel uses such conventions by default. For example, when using the command: PhP Artisan Make: Migration Create_nameTablaplural_Table, it will create the file in the Database/Migrations folder, with the <TimestamS_Create_Create_Create_Create_CRETA Now if you want to create from a model, using the Artisan Make PHP Command: Model Modelosingular Name -M, as an option to automatically generate the migration corresponding to said model.