Update PerAppCredit.md file

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
Vitalii Koshura 2023-04-03 00:02:54 +02:00
parent e511c6df45
commit 8efbf7c16c
No known key found for this signature in database
GPG Key ID: CE0DB1726070A5A3
1 changed files with 39 additions and 38 deletions

@ -1,69 +1,70 @@
[[PageOutline]] # Per-app credit
By default, BOINC maintains the credit granted to By default, BOINC maintains the credit granted to
teams, users, and hosts, both total and average. teams, users, and hosts, both total and average.
You can optionally maintain credit for teams and users You can optionally maintain credit for teams and users
on a per-application basis. on a per-application basis.
This information is stored in DB tables *credit_user_' and '_credit_team*. This information is stored in DB tables **credit_user** and **credit_team**.
Note: doing this will increase DB size and server load. Note: doing this will increase DB size and server load.
To maintain per-app credit, put To maintain per-app credit, put
```
<credit_by_app/> <credit_by_app/>
```
in your config.xml file. in your config.xml file.
# Displaying per-app credit ## Displaying per-app credit
Per-app credit is displayed and exported in terms of *sub-projects*. Per-app credit is displayed and exported in terms of **sub-projects**.
A sub-project is a named set of apps. A sub-project is a named set of apps.
Define your sup-projects in _html/project/project.inc_ in the form Define your sup-projects in *html/project/project.inc* in the form
```
$sub_projects = array( $sub_projects = array(
array("name" => "Remote Test", "short_name" => "RT", "appids" => array(16)), array("name" => "Remote Test", "short_name" => "RT", "appids" => array(16)),
array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)),
); );
```
**name** is what's shown on web pages.
*name* is what's shown on web pages. **short_name** is optional, and is used to form badge names (see below).
*short_name* is optional, and is used to form badge names (see below).
To display per-app credit on your web site To display per-app credit on your web site
(in the user and team pages) (in the user and team pages)
you must supply functions you must supply functions
```
project_user_credit($user) project_user_credit($user)
project_team_credit($team) project_team_credit($team)
```
in your *html/project/project.inc*. in your **html/project/project.inc**.
These functions must generate table rows describing These functions must generate table rows describing
the credit granted to each app for the given user or team. the credit granted to each app for the given user or team.
The example file *boinc/html/project.sample/project.inc* The example file **boinc/html/project.sample/project.inc**
contains an example of how to do this. contains an example of how to do this.
Remove the *if(0)* and change the sub-project specs to suit your project. Remove the **if(0)** and change the sub-project specs to suit your project.
# Exporting per-app credit ## Exporting per-app credit
The [db_dump](DbDump) program writes per-app credit in two files The [db_dump](DbDump) program writes per-app credit in two files
*user_work.gz_' and '_team_work.gz* in your html/stats directory. **user_work.gz** and **team_work.gz** in your html/stats directory.
# Decaying per-app credit ## Decaying per-app credit
Average credit is automatically decayed when credit is granted. Average credit is automatically decayed when credit is granted.
However, if a user or team stops getting credit, this won't happen; However, if a user or team stops getting credit, this won't happen;
you need to run a script *decay_per_app_credit.php* you need to run a script **decay_credit_by_app.php**
to decay the credit of inactive users and teams. to decay the credit of inactive users and teams.
Add something like this to your config.xml: Add something like this to your config.xml:
```
<task> <task>
<output>decay_per_app_credit.out</output> <output>decay_per_app_credit.out</output>
<cmd>run_in_ops decay_per_app_credit.php</cmd> <cmd>run_in_ops decay_credit_by_app.php</cmd>
<period>1 day</period> <period>1 day</period>
</task> </task>
```
## Granting badges based on per-app credit
# Granting badges based on per-app credit The script **html/ops/badge_assign_custom.php** grants badges based
The script *html/ops/badge_assign_custom.php* grants badges based
on subproject credit totals. on subproject credit totals.
See its comments for instructions. See its comments for instructions.