Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@TomerMe2
Copy link
Collaborator

I made the adjustments for updatePlanTags in order for us to call it from a cron job.
It updates the tags of the necessary plans only.

Closes #393

exports.up = function(knex) {
return knex.schema.table('plan', table => {
// some default time
table.dateTime('last_tags_update').notNullable().defaultTo('2000-01-01 00:00:01');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not null?

// Before re-computing the tags of a plan, remove all previous tags for this plan.

// TODO: Loop on the plans that need to be updated
const plans = await Plan.getPlansToTag();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please limit to 5 plans


} catch (err) {
Log.error(err);
Log.error('had a problem saving tags for plan ' + plan_id + '\n' + err);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log.error(problem saving tags for plan ${plan_id} , err);

// TODO: Loop on the plans that need to be updated
const plans = await Plan.getPlansToTag();
Log.info(`Processing ${plans.models.length} plans`);
for (const planOrder in plans.models) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for await (const planOrder of plans.models) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tag Maker Job

4 participants