enterprisemediawiki / SemanticActions

An action tracking system for a Semantic MediaWiki
MIT License
3 stars 2 forks source link

"None of these labels" column has a display issue when used on Template:Person #21

Open darenwelsh opened 5 years ago

darenwelsh commented 5 years ago
darenwelsh commented 5 years ago

It looks like this column is exceeding some limit due to trying to parse so many actions, especially when not filtered by Property:Related article.

darenwelsh commented 5 years ago

In playing around with an action board and using the MediaWiki preview feature, if I leave the filter for Related article field blank I get the following message:

Warning: Template include size is too large. Some templates will not be included.
darenwelsh commented 5 years ago

One option would be to count the number of actions returned for the optional left column and if that number exceeds some limit, it only parses some and provides a link for more.

This can also be helped by making the templates more efficient, but it will never solve the problem for a system with thousands of actions.

For example:

Template:Actionable board column can be modified to include ?Summary in the results and pass them to Template:Actionable board row and remove two instances of {{#show:{{{1|}}}|?Summary}}

darenwelsh commented 4 years ago

In case it gets overwritten from the dev server, here's a way to maybe do this using Cargo:

In Template:Actionable, add the following in the <noinclude> section (and move that noinclude section to the top before includeonly):

<!--

DECLARE CARGO TABLE

-->{{#cargo_declare:_table=Actionable
|Action_ID=Integer
|Page_title_text=String
|Summary=Searchtext
|Assigned_to=List (,) of Page
|Action_status=String
|Due_date=Date
|Related_article=List (,) of Page
|Label=List (,) of String
|Resolution=Wikitext
|Details=Wikitext
}}

In the same template, in the <includeonly> section later in the page, add:

<!--

SET CARGO TABLE DATA

-->{{#cargo_store:_table=Actionable
|Action_ID={{#sub:{{FULLPAGENAME}}|7|0}} 
|Page_title_text=Action:{{#sub:{{FULLPAGENAME}}|7|0}}
|Summary={{{SUMMARY|}}}
|Assigned_to={{{ASSIGNED_TO|}}}
|Action_status={{{ACTION_STATUS|Open}}}
|Due_date={{{DUE_DATE|}}}
|Related_article={{{RELATED_ARTICLE|}}}
|Label={{#replace:{{{LABEL|}}}|Label:|}}
|Resolution={{{RESOLUTION|}}}
|Details={{{DETAILS|}}}
}}

Then here is a sample query:

{{#cargo_query:
tables=Actionable
|fields=_pageName,Action_ID,Page_title_text,Summary,Assigned_to,Action_status,Due_date,Related_article,Label__full,Resolution,Details
|where=(Action_status='Open' AND Actionable.Label__full NOT RLIKE ".*(^{{!}},\s*)In work(${{!}}\s*,).*" AND Actionable.Label__full NOT RLIKE ".*(^{{!}},\s*)Long Term(${{!}}\s*,).*" AND Actionable.Label__full NOT RLIKE ".*(^{{!}},\s*)Near Term(${{!}}\s*,).*")
|group by=
|having=
|order by=
|limit=5000
|offset=
|intro=
|outro=
|default=
|more results text=
|max display chars=
|format=
}}
darenwelsh commented 4 years ago

If I go with Cargo, consider linking to Special:Drilldown/Actionable so users can drill down on all actions

darenwelsh commented 4 years ago

When this is all fixed, on Template:Person change from false to true to display the left column.

darenwelsh commented 4 years ago

Template:Actionable board column will need:

{{#cargo_query:
tables=Actionable
|fields=_pageName,Action_ID,Due_date,Assigned_to__full,Label__full,Related_article__full
|where=(Action_ID > 0 
{{#switch:{{{1|}}} | Open = AND Action_status='Open' | Closed = AND Action_status='Closed' | }}
{{#if:{{{2|}}}|{{#arraymap:{{{2|}}}|,|VAR| AND Related_article__full RLIKE ".*(^{{!}},\s*)'VAR'(${{!}}\s*,).*" | }} |}}
{{#if:{{{4|}}}|{{#arraymap:{{{4|}}}|,|VAR| AND Label__full NOT RLIKE ".*(^{{!}},\s*){{#replace:VAR|Label:|}}(${{!}}\s*,).*" | \s\s}} |}}
)
|group by=
|having=
|order by=
|limit=5000
|offset=
|intro=
|outro=
|default=
|more results text=
|max display chars=
|format=template
|template=Actionable board row
}}
darenwelsh commented 4 years ago

Once Cargo is added, update the README to show examples of how to use it, including Special:Drilldown

darenwelsh commented 4 years ago

c0d8c5cab7aa34d4e9d04910822d45d57174de5b added cargo versions of the action board and action board column templates. More work will need to be done to make these completely cargo. For now it just improves the situation for the left column by using cargo.

darenwelsh commented 4 years ago

Some thought needs to be put into whether adding Cargo support is a good idea. One important thing to note is that Cargo has one flaw for this use case, in my opinion. Cargo queries do not include results where values are redirects.

Let's say there's a page called Action:60 and it has the value of "Puppy" as a value for Related_article. But "Puppy" is just a redirect to the page called "Dog". Action:60 will not show up in the results of a query filtering on the value of the redirected-to page "Dog".

Such a query would look like the following example.

{{#cargo_query:
tables=Actionable
|fields=Action_ID, _pageName, Related_article__full = Related article
|where=Related_article HOLDS 'Dog'
|group by=Related_article
}}

Demo

Cargo

Query for "Puppy" value of Related_article

{{#cargo_query: tables=Actionable |fields=Action_ID, _pageName, Related_article__full = Related article |where=Related_article HOLDS 'Puppy' |group by=Related_article }}

Query for "Dog" value of Related_article

{{#cargo_query: tables=Actionable |fields=Action_ID, _pageName, Related_article__full = Related article |where=Related_article HOLDS 'Dog' |group by=Related_article }}

SMW

Query for "Puppy" value of Related_article

{{#ask: [[Related article::Puppy]] |?Action ID |?Related article }}

Query for "Dog" value of Related_article

{{#ask: [[Related article::Dog]] |?Action ID |?Related article }}

Discussion

This is because Cargo treats a redirect to a page and that redirect-to page as separate entities. Technically speaking, they are. But when using SMW they are treated as equal. We have 8+ years of treating redirects as equal to the redirected-to pages.

This means two very important things if you are going to use Cargo:

  1. Users cannot use redirect pages as values in cargo properties if they want to query based on the redirect-to page.
  2. Any time a page is moved and a redirect is left behind, you must use Special:ReplaceText to find that pagename in any template fields and updated it.

See related discussion topic (mediawiki.org).