Are skill modifiers cumulative (even beyond plus/minus 30%)?

I haven’t GMed Warhammer FRP 2nd edition for quite a while and my knowledge’s gone a bit rusty, I’m afraid.

Are skill modifiers cumulative (even beyond plus/minus 30%) in WFRP 2nd edition?

I tried to find the answer in the core book, but all I found was that skill difficulty modifiers are mostly up to the GM, and that they very rarely exceed +/- 30%. Is that correct, or have I missed something?

For example, Hans is about to parry with his off-hand weapon, which gives him a -20% (as it’s not defensive and he’s not ambidexterous), and it’s pouring at night, in a back alley, which I’d say is also a -20% (because it’s slippery and dark and Hans can’t see much.) Does he roll with -40%, or does it stop at -30% (as all these things make it a “Very Hard” roll which means -30%)?

User rank based on cumulative rows

Table structure (some fields are hidden):

+---------+---------+------------+-------------+-------+-------+ | user_id | kind_id | country_id | province_id | value | score | +---------+---------+------------+-------------+-------+-------+ |       1 |     201 |          1 |           1 |     1 |     5 | |       1 |     102 |          1 |           1 |    31 |   155 | |       1 |     201 |          1 |           1 |     6 |    30 | |       1 |     109 |          1 |           1 |    33 |   165 | |       2 |     202 |          1 |           4 |    76 |   380 | |       2 |     201 |          1 |           4 |     5 |    25 | |       2 |     209 |          1 |           4 |     9 |    45 | |       2 |     302 |          1 |           4 |     8 |    40 | |       2 |     201 |          1 |           4 |    14 |    70 | |       3 |     201 |          1 |           9 |     7 |    35 | |       3 |     201 |          1 |           9 |     9 |    45 | |       3 |     201 |          1 |           9 |     2 |    10 | |       3 |     201 |          1 |           9 |     5 |    25 | |       3 |     201 |          1 |           9 |     7 |    35 | |     ... |     ... |        ... |         ... |   ... |   ... | +---------+---------+------------+-------------+-------+-------+ 

Rank is calculated based on sum of score of user’s activities. I saw many questions here and on Stackoverflow but my problem is more complex.

I need 3 rank values per user: global, country (for users in same country), province (same as country). For example a rank value for user 1 may be like this {"global": 9, "country": 3, "province": 1}. I do not need rank of all users but for one individual user.

I tried a dozen queries but can’t calculate this three with one query. or, at least, three clean and efficient queries.

I will cache the result for some time, but still efficiency is important since the activities table contains many records and will grow as time passes.

How can I do this?

Thanks.

Cumulative sum of a dataframe column with restart

I would like to perform the following function on a dataframe.

Calculate the cumulative sum of a column, notice:

  1. It looks at the previous index only, not including the current one, e.g. the very first one will be zero as there is no previous data to look at.

  2. When it doesn’t cumulate, e.g the increment is zero, it restarts the count.

          Number  Cumulative    0       1           0    1       1           1    2       1           2    3       0           3    4       0           0    5       1           0    6       1           1    7       0           2 

I know there is an expanding function, but it doesnt restart when it sees zero