Page MenuHomePhabricator

Automatically end a campaign by comparing wall clock time
Needs RevisionPublic

Authored by Nehajha on Jan 29 2018, 7:10 PM.


Maniphest Tasks
T89452: Start and end campaign automatically at specified time
Patch without arc
git checkout -b D953 && curl -L | git apply

End a campaign by comparing end date and system time

Diff Detail

rWIEG wikimedia-iegreview
No Lint Coverage
No Test Coverage
Build Status
Buildable 2703
Build 4515: differential-jessieJenkins
Build 4514: arc lint + arc unit

Event Timeline

bd808 requested changes to this revision.Mar 5 2018, 4:23 AM

I'm not a fan of this approach. This makes database changes based on an HTTP GET request. The GET verb should ideally be idempotent (not cause any state changes). It also adds N+1 to 2N+1 database queries to each view of the landing page where N is the number of existing campaigns.

The change I expected is to stop using the status field in the campaigns table entirely and instead replace it with a comparison between the current server time and the campaigns.end_date value. Since we don't have a true model object for the campaigns and instead pass around arrays of data it may be easiest to actually compute the binary status inside Wikimedia\IEGReview\Dao\Campaigns when retrieving campaign information. One way to do this would be to use a phrase like CAST(end_date < NOW() AS INT) AS status in the SELECT statements.


endCampaign is still used in Wikimedia\IEGReview\Controllers\Admin\CampaignEnd.

This revision now requires changes to proceed.Mar 5 2018, 4:23 AM