The specification describes a Web Portal for viewing call test results.
A user will have the ability to login to the portal and find the results they need using standard features like search, sort and filters. Also, users will have the ability to import new results through the portal and also export test results that already exist.
There is an admin user role which can manage user accounts, creating/editing/deleting them as they see fit.
The following were used in development:
- XAMPP for Linux 7.2.26-0 (PHP 7.2.26, Apache/2.4.41 (Unix), MariaDB 10.4.11)
- CakePHP 3.8.8 - For the server code.
- Bootstrap 4.4 - For front end UI
- Name:
trdb
in development, - Tables:
users
,results
- Name:
users
- Name:
results
Users::login()
- Login view
Results::index()
- Results listing pageResults::search()
- Asindex()
but filteredResults::filter()
- Asindex()
but filteredUsers::view()
- User's own account page
Users::index()
- Users listing pageUsers::search()
- Asindex()
but filteredUsers::filter()
- Asindex()
but filtered
Results::import()
- Import results as csvUsers::add()
- Add new user (Admin only)Users::edit()
- Add a user's details (Admin only)
- Clone this repo and push to Github
- Create new app from Heroku dashboard
- name "tr-portal" (or whatever)
- region Europe
- Click "Find more add-ons" and select "ClearDB MySQL"
- Click "Install ClearDB MySQL"
- Choose "tr-portal" as the app to provision
- Click "Provision add-on"
- Click "ClearDB MySQL"
- Copy the name and click it
- Go to the "System Information" tab and copy the username and password
- Go back to Settings => "Reveal Config Vars".
You will find the DSN set as CLEARDB_DATABASE_URL. This is the DSN needed to connect to the database. Create a new config var called DATABASE_URL, with the same value (as you will set'url' => env('DATABASE_URL', null),
inconfig/app.php
). - Now set the username and password as config vars too:
(or do it in the Heroku dashboard)
23:11: trportal $ heroku config:set USERNAME=unxxxxxxxx -a tr-portal Setting USERNAME and restarting ⬢ tr-portal... done, v5 USERNAME: unxxxxxxxx ====================================================================================================================== 23:41: trportal $ heroku config:set PASSWORD=pwxxxxx -a tr-portal Setting PASSWORD and restarting ⬢ tr-portal... done, v6 PASSWORD: pwxxxxx
- Back in the dashboard, click the "Deploy" tab and go to "Deployment method".
- Click "Github", enter the Github repo name and click "Search"
- Your repo name should be displayed: click "Connect".
- Click "Enable Automatic Deploys". You should see "Automatic deploys from master are enabled".
- In
config/app.php
insideDatasources' => ['default']
set the following:'username' => env('USERNAME', null), 'password' => env('PASSWORD', null), 'database' => env('DATABASE', null),
You may need to remove config/app.php
from the default .gitignore
.
You must ensure:
- PHP is installed with the
mbstring
andintl
extensions. - The
tmp
andlogs
directories are writeable both by the web server and the command line user.
- Generate a snapshot of the local database using phpMyAdmin.
- Fire up a Mysql shell locally and connect to the remote database with its DSN, username and password.
- Paste in the sql and hit
Enter
!
- For the name of the database table,
results
has been used rather thandata
(to conform with CakePHP Inflexion convention). - Field names
job_processing_uid
andtest_type_uid
have been used rather thanjob_processing_id
andtest_type_id
(to avoid assumptions Cake, or bake, may make about field names ending in_id
being foreign keys.) - The
status
column of theUsers
table has been implemented asTINYINT(2)
(as it has 3 possible values, andTINYINT(1)
is interpreted as a Boolean.)
- "Target environment: Chrome" is assumed to mean a modern versions of Chrome which supports ES2015 and CSS3 syntax. The application was developed using Chromium 79 and tested on Chrome 79. For older versions it may be necessary to introduce tools like Babel into the workflow.
- Link to call audio recording has been set to open in a new tab. This is not stated in the spec but seems sensible as it's an external link.
- Filtering by date range, and search (for results) and filtering by status and search (for users) are independent of each other. It was not entirely clear to me what was intended from the spec.
- The oldest year for filtering results has been set at 1990.
Search
submits only whenEnter
is pressed. It could be changed to submit each time a character is typed, but this would result in more HTTP requests - although perhaps for smaller datasets results could be cached at the front end?
-
Fix and test password validation on login, edit user and add user.
-
Login bug - sometimes: the first login fails, the second try works. Check authorisation works correctly for non-admins (i.e. no access to Users except self).
-
Check fixing login functionality obviates inappropriate Auth Flash messages.
-
Check all styling.
-
Check if some code can move from Controllers into models.
-
Check code is reasonably DRY.
-
Writeup README.
-
Cannot sort by
id_str
orduration
as these are computed properties, not model fields; there should be a way of doing this with the Paginator class. -
When user edits own profile, need to update the cookie.