chore: show last scan for child feeds
This commit is contained in:
		
							parent
							
								
									d85dd56ac9
								
							
						
					
					
						commit
						84c3099be6
					
				
							
								
								
									
										28
									
								
								http.go
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								http.go
									
									
									
									
									
								
							@ -159,10 +159,8 @@ func httpServer(ctx context.Context, app *appState) error {
 | 
				
			|||||||
			attribute.Int64("offset-start", offset-int64(limit)),
 | 
								attribute.Int64("offset-start", offset-int64(limit)),
 | 
				
			||||||
			attribute.Int64("max", end),
 | 
								attribute.Int64("max", end),
 | 
				
			||||||
		))
 | 
							))
 | 
				
			||||||
		w.Header().Set("Content-Type", "text/plain; charset=utf-8")
 | 
							qry := `
 | 
				
			||||||
		rows, err := db.QueryContext(
 | 
								SELECT
 | 
				
			||||||
			ctx,
 | 
					 | 
				
			||||||
			`SELECT
 | 
					 | 
				
			||||||
				feed_id,
 | 
									feed_id,
 | 
				
			||||||
				hash,
 | 
									hash,
 | 
				
			||||||
				conv,
 | 
									conv,
 | 
				
			||||||
@ -181,7 +179,11 @@ func httpServer(ctx context.Context, app *appState) error {
 | 
				
			|||||||
			order by ulid asc
 | 
								order by ulid asc
 | 
				
			||||||
			limit ?
 | 
								limit ?
 | 
				
			||||||
			offset ?
 | 
								offset ?
 | 
				
			||||||
					`, args...,
 | 
							`
 | 
				
			||||||
 | 
							fmt.Println(qry, args)
 | 
				
			||||||
 | 
							w.Header().Set("Content-Type", "text/plain; charset=utf-8")
 | 
				
			||||||
 | 
							rows, err := db.QueryContext(
 | 
				
			||||||
 | 
								ctx, qry, args...,
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			span.RecordError(err)
 | 
								span.RecordError(err)
 | 
				
			||||||
@ -239,25 +241,27 @@ func httpServer(ctx context.Context, app *appState) error {
 | 
				
			|||||||
			args = append(args, feed_id, feed_id)
 | 
								args = append(args, feed_id, feed_id)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		rows, err := db.QueryContext(
 | 
							qry := `
 | 
				
			||||||
			ctx,
 | 
								SELECT
 | 
				
			||||||
			`SELECT
 | 
					 | 
				
			||||||
				feed_id,
 | 
									feed_id,
 | 
				
			||||||
				uri,
 | 
									uri,
 | 
				
			||||||
				nick,
 | 
									nick,
 | 
				
			||||||
				last_scan_on,
 | 
									last_scan_on,
 | 
				
			||||||
					last_twt_on
 | 
									coalesce(last_twt_on, last_scan_on) last_twt_on
 | 
				
			||||||
			FROM feeds
 | 
								FROM feeds
 | 
				
			||||||
			left join (
 | 
								left join (
 | 
				
			||||||
				select
 | 
									select
 | 
				
			||||||
					feed_id,
 | 
										feed_id,
 | 
				
			||||||
					max(strftime('%Y-%m-%dT%H:%M:%fZ', (substring(text, 1, instr(text, '	')-1)))) last_twt_on
 | 
										max(strftime('%Y-%m-%dT%H:%M:%fZ', (substring(text, 1, instr(text, '	')-1)))) last_twt_on
 | 
				
			||||||
					from twts group by feed_id
 | 
									from twts
 | 
				
			||||||
 | 
									group by feed_id
 | 
				
			||||||
			) using (feed_id)
 | 
								) using (feed_id)
 | 
				
			||||||
			` + where + `
 | 
								` + where + `
 | 
				
			||||||
			order by nick, uri
 | 
								order by nick, uri
 | 
				
			||||||
            `, args...,
 | 
							`
 | 
				
			||||||
		)
 | 
							fmt.Println(qry, args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							rows, err := db.QueryContext(ctx, qry, args...)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			span.RecordError(err)
 | 
								span.RecordError(err)
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user