1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00
Commit graph

287 commits

Author SHA1 Message Date
Alexandre Avenel
baba943e62 Fix xss (#173)
Fix #173
Rewrite multi select widget as a template in order to have all values properly escaped.
2017-02-16 23:11:30 +01:00
Alexis Metaireau
3dd7c67ecf Merge pull request #172 from JocelynDelalande/jd-bootstrap-4
WIP: Upgrade to bootstrap 4
2017-02-15 20:42:48 +01:00
Jocelyn Delalande
57596b5f46 Prevent "Add new bill" button flickering 2017-02-09 16:49:01 +01:00
Jocelyn Delalande
7d3ebe5378 Prevent dancing cells while hovering sidebar lines
Fix a regression introduced with BS4 update.
2017-02-09 16:41:19 +01:00
Jocelyn Delalande
8b96dcb257 Prevent modal overflow
Allowing the modal to extend; thus "natural" page scrolling allows to see the
whole popup.
2017-02-09 15:47:28 +01:00
Jocelyn Delalande
0aafbcc0b3 Update bootstrap-datepicker to 1.6.4
Actually switching to maintained fork at
https://github.com/uxsolutions/bootstrap-datepicker ; the original project
being unmaintained since 2012.

- Works with recent jQuery
- BS4 is not supported by bootstrap-datepicker, but actually, it works :-)

ref https://github.com/uxsolutions/bootstrap-datepicker/issues/1670
2017-02-07 15:38:18 +01:00
Jocelyn Delalande
fe39258630 Adapt list bills view to bootstrap 4
- modal classes and hierarchy changed since BS2
- striped tables are now handled by css3 pseudo-class rather than classes
- fix placement/alignment for the button and comment above the table
2017-02-04 00:41:28 +01:00
Jocelyn Delalande
a47d91fab9 Do not force huge add member button
BS4 provides larger touch-friendly controls anyway.
2017-02-04 00:41:28 +01:00
Jocelyn Delalande
f9856cb991 Adapt tryout button to bootstrap 4
Trying to keep same look'n'feel.
2017-02-04 00:41:28 +01:00
Jocelyn Delalande
c6c5f8657e Adapt navigation bar to bootstrap 4
Also fixed some weird alignment issues.
I think this will need more work later (revamp the navbar layout to avoid that
sensation of thing which are floating at random places in the navbar).
2017-02-04 00:41:28 +01:00
Jocelyn Delalande
e148d19e96 Add a label for screen-readers on user add form
There was no label, which is bad for accessibility.
2017-02-04 00:41:28 +01:00
Jocelyn Delalande
a3cbede680 Refactor layout based on bootstrap 4 grid 2017-02-04 00:41:20 +01:00
Jocelyn Delalande
2862130269 Adapt to bootstrap 4 forms
- Adapt to BS4 class names and hierarchy
- Redesign some forms to have the label above the input (mobile-friendly)
- For the remaining inline form (add bill), use the grid, as BS no longer
  provides inline form alignment helpers
2017-02-04 00:41:05 +01:00
Jocelyn Delalande
37da1db38a Update bootstrap dependency to bootstrap 4 2017-02-04 00:40:59 +01:00
Berteh
c9b5e87b90 Improve translation for user edit form. 2017-02-01 22:30:59 +01:00
Jocelyn Delalande
87d2dea9c8 Factor navbar between list_bills and settle_bill 2017-01-30 23:23:03 +01:00
Alexandre Avenel
5d009d839b Fix deprecation issues (ExtDeprecationWarning) 2017-01-21 15:03:58 +01:00
Alexandre Avenel
58aebf1069 Fix unit test rounding :
Test was Ok but failed due to some floating point errors.
2017-01-21 14:12:49 +01:00
Alexis Metaireau
963fcf0af1 Merge pull request #166 from JocelynDelalande/jd-fix-prefixed-test
Fix ServerTestCase.test_unprefixed test
2017-01-17 09:34:47 +01:00
Alexis Metaireau
8615fde00a Merge pull request #161 from zorun/optimise_sql
Optimise sql queries
2017-01-16 21:15:43 +01:00
Alexis Metaireau
dc75a72dd0 Merge pull request #164 from zorun/fix_zero_transfers
Fix zero-amount transfers and other rounding issues
2017-01-16 21:13:56 +01:00
Jocelyn Delalande
376a0b37e3 Fix ServerTestCase.test_unprefixed test
The test was always failing, actual reason is the `app.run.configure()` fails
to reset the `APPLICATION_ROOT` setting which `ServerTestCase.test_prefixed`
overloads (side effect).

This patch *do not* fix app.run.configure as it seems uneasy, but takes a
different approach which has the advantage of making the test more explicit.

Would still be a good thing to investigate more on configure().

Fix #163
2017-01-09 10:11:50 +01:00
Baptiste Jonglez
d6cf89008f Workaround rounding issues when displaying balance of users
A user with a "0.00" balance would have either a "+0.00" in green or a
"-0.00" in red, depending on the exact value of the floating-point value.

Fix this by simply rounding to 2 digits before comparing to zero.
2017-01-03 21:37:19 +01:00
Baptiste Jonglez
b507a5afa1 Prevent transfers with a zero amount in the settle page
This workarounds a rounding issue caused by the (incorrect) usage of
floats for bill amounts.

This fixes #138
2017-01-03 21:37:19 +01:00
Baptiste Jonglez
543df7c1d4 Add a test to catch zero-amount transfers in the settle page 2017-01-03 21:37:19 +01:00
Baptiste Jonglez
699db1c4c8 Sort bills by (date.desc, ID.desc) instead of just date.desc
When viewing the list of bills, bills are (correctly) sorted by date.  But
the order of all bills for a given day is not intuitive: I would expect
bills to be sorted by reverse order of insertion.  That is, the last bill
to be added for a given day should appear first, not last.  Otherwise,
when adding several bills in a row for a given day, it's confusing to see
that the new bills do not appear on top of the list.

Fix this by sorting by decreasing ID after sorting by date.
2017-01-02 13:22:28 +01:00
Baptiste Jonglez
8e5ac8ae98 Optimise SQL queries when computing balance
This avoids creating thousands of small SQL queries when computing the
balance of users.  This significantly improves the performance of
displaying the main page of a project, since the balance of users is
displayed there:

    Before this commit: 4004 SQL queries, 19793 ms elapsed time, 19753 ms CPU time, 2094 ms SQL time
    After this commit:    12 SQL queries,  3688 ms elapsed time,  3753 ms CPU time,   50 ms SQL time
    Measured request:   display the sidebar with the balance of all users for the project (without displaying the list of bills)

This commit also greatly improves the performance of the "settle bills" page:

    Before this commit: 8006 SQL queries, 39167 ms elapsed time, 39600 ms CPU time, 4141 ms SQL time
    After this commit:    22 SQL queries,  7144 ms elapsed time,  7283 ms CPU time,   96 ms SQL time
    Measured request:   display the "Settle bills" page

Test setup to measure performance improvement:

- 5 users with various weights
- 1000 bills, each paid by a random user, each involving all 5 users
- laptop with Celeron N2830@2.16 GHz, SSD Samsung 850 EVO
- sqlite database on SSD, using sqlite 3.15.2
- python 2.7.13
- Flask-DebugToolbar 0.10.0 (to count SQL queries and loading time)

Performance measurements (using Flask-DebugToolbar on the second request,
to avoid measuring cold-cache performance):

- number of SQL queries
- elapsed time (from request to response)
- total CPU time consumed by the server handling the request
- total time spent on SQL queries (as reported by SQLAlchemy)
2017-01-02 13:09:26 +01:00
Baptiste Jonglez
74df614007 Optimise SQL queries when displaying bills for a project
By defaut, SQLAlchemy uses lazy loading, which means that displaying n
bills will generate around n queries (to get the list of owers of each
bill).  Pre-load the list of owers to drastically decrease the number of
SQL queries.

Before this commit: 1004 SQL queries, 7535 ms elapsed time, 7536 ms CPU time, 530 ms SQL time

After this commit: 5 SQL queries, 3342 ms elapsed time, 3393 ms CPU time, 15 ms SQL time

Measured request: display the list of all bills for the project (without displaying the sidebar with balances)

Test setup to measure performance improvement:

- 5 users with various weights
- 1000 bills, each paid by a random user, each involving all 5 users
- laptop with Celeron N2830@2.16 GHz, SSD Samsung 850 EVO
- sqlite database on SSD, using sqlite 3.15.2
- python 2.7.13
- Flask-DebugToolbar 0.10.0 (to count SQL queries and loading time)

Performance measurements (using Flask-DebugToolbar with the second
request, to avoid measuring cold-cache performance):

- number of SQL queries
- elapsed time (from request to response)
- total CPU time consumed by the server handling the request
- total time spent on SQL queries (as reported by SQLAlchemy)
2017-01-02 13:09:26 +01:00
Alexis Metaireau
7ba9048b06 Merge pull request #150 from fredericsureau/negative-amounts
Allow negative bill amounts
2016-09-12 17:54:58 +02:00
fredericsureau
c9b2d17f60 Update negative amounts test 2016-09-12 16:30:01 +02:00
fredericsureau
a1f1655f06 Allow negative bill amounts 2016-09-12 14:21:57 +02:00
Adam Chainz
a80202e066 Convert readthedocs links for their .org -> .io migration for hosted projects
As per [their blog post of the 27th April](https://blog.readthedocs.com/securing-subdomains/) ‘Securing subdomains’:

> Starting today, Read the Docs will start hosting projects from subdomains on the domain readthedocs.io, instead of on readthedocs.org. This change addresses some security concerns around site cookies while hosting user generated data on the same domain as our dashboard.

Test Plan: Manually visited all the links I’ve modified.
2016-06-28 07:46:50 +01:00
Jocelyn Delande
a5579220e0 Fix migrations upgrade path for MySQL
For some reason, the migration path from unmanaged db (from alembic
point-of-view) to managed db, through the initial migration works well with
sqlite… But not with mysql where the db system tries to re-create the existing
tables.

This commit is a way to detect if we are migrating from pre-alembic era and
skip the first migration (which would do nothing anyway), marking it as already
executed.

It's quite hackish but that's the best I found so far to get it working with
both MySQL and SQLite.
2016-06-18 12:13:46 +02:00
Jocelyn Delande
c49a355eb0 Update translation 2016-06-16 15:52:24 +02:00
Jocelyn Delande
d3bb04c1bf Add migration to initialize Person weights
That's for Persons that existed before the weights were added to model.
2016-06-16 15:52:24 +02:00
Jocelyn Delande
7a630b78ea Hide the member weights in members list if all weights are "1". 2016-06-16 15:52:24 +02:00
Jocelyn Delande
ec8fe2326b Added member edit form 2016-06-16 15:52:24 +02:00
Jocelyn Delande
64c2cd56df display an edit button on members list 2016-06-15 10:20:37 +02:00
Jocelyn Delande
1147f2ece8 Ask for confirmation only for deleting users 2016-06-15 10:20:37 +02:00
Jocelyn Delande
85abc0b1fc Added a template filter not to show zero decimals on user weights 2016-06-15 10:20:37 +02:00
Jocelyn Delande
b57df5cd36 UI for showing user weights in user list 2016-06-15 10:20:37 +02:00
Jocelyn Delande
06f10d0508 Added member weights support to API 2016-06-15 10:20:37 +02:00
Jocelyn Delande
2b071a1a3b Add members weight in models and budget backend refs #94 2016-06-15 10:20:37 +02:00
Jocelyn Delande
465deabd02 Add a manage.py CLI (flask_script)
As it's the Flask-Migrate way to expose its commands (./manage.py db command).

In our case, it's specially useful for creating new migrations.
2016-05-31 12:10:53 +02:00
Jocelyn Delande
74995f9959 Handle migrations through alembic/flask-Migrations
Auto-initialization now applies migrations instead of using db. create_all()

fix #83
2016-05-31 12:10:53 +02:00
Jocelyn Delande
b685fa74d6 Do not load user-overriden settings in unit tests.
Loading not versioned settings.py during tests make them less predictable.
That's inspired from django behaviour with DJANGO_SETTING_MODULE environment variable.
2016-04-03 22:31:32 +02:00
Alexis Metaireau
a8841f9d3f Merge pull request #122 from JocelynDelalande/configurable-prefix
Made an URL prefix configurable in settings
2015-11-09 09:26:11 +01:00
Mathieu Leplatre
eff0f7c2df Prevent comma to be included in URL 2015-09-25 12:32:56 +02:00
Mathieu Leplatre
c6c40f02c5 Prevent comma to be included in URL 2015-09-25 12:31:52 +02:00
Quentin Roy
d31de6c4a3 Merge pull request #130 from JocelynDelalande/trailing-whitespaces
Remove trailing whitespaces
2015-08-20 12:08:52 +02:00