Changes between Version 1 and Version 2 of ComplexReports


Ignore:
Timestamp:
01/27/26 23:40:01 (12 days ago)
Author:
233051
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ComplexReports

    v1 v2  
    2121ORDER BY usage_count DESC, avg_build_rating DESC
    2222LIMIT 20;
     23}}}
     24
     25{{{
     26λ_20(
     27 τ_{usage_count DESC, avg_build_rating DESC}(
     28  σ_{avg_build_rating ≥ 4.5}(
     29   γ_{c.type, c.brand, c.name;
     30     COUNT(bc.component_id)→usage_count,
     31     AVG(rb.value)→avg_build_rating
     32   }(
     33    σ_{b.created_at ≥ CURRENT_DATE - 1 year}(
     34     (((components c ⋈_{c.id=bc.component_id} build_component bc)
     35       ⋈_{bc.build_id=b.id} build b)
     36       ⋈_{b.id=rb.build_id} rating_build rb)
     37    )
     38   )
     39  )
     40 )
     41)
    2342}}}
    2443
     
    6786ORDER BY reputation_score DESC
    6887LIMIT 10;
     88}}}
     89
     90{{{
     91build_stats =
     92γ_{b.id → build_id, b.user_id;
     93   COUNT_DISTINCT(fb.user_id) → favorites_count,
     94   AVG(rb.value) → avg_rating
     95} (
     96  σ_{b.is_approved = TRUE} (
     97    (build b
     98      ⟕_{b.id = fb.build_id} favorite_build fb)
     99      ⟕_{b.id = rb.build_id} rating_build rb
     100  )
     101)
     102
     103user_stats =
     104γ_{user_id;
     105COUNT(build_id) → approved_builds_count,
     106SUM(favorites_count) → total_favorites_received,
     107AVG(avg_rating) → avg_rating_received
     108} (
     109build_stats
     110)
     111
     112λ_10 (
     113  τ_{reputation_score DESC} (
     114    π_{u.username,
     115      u.email,
     116      us.approved_builds_count,
     117      us.total_favorites_received,
     118      ROUND(us.avg_rating_received, 2) → avg_rating_received,
     119      ((us.approved_builds_count * 10)
     120       + (us.total_favorites_received * 5)
     121       + (us.avg_rating_received * 20)) → reputation_score
     122    } (
     123      user_stats us ⋈_{u.id = us.user_id} users u
     124    )
     125  )
     126)
    69127}}}
    70128
     
    116174LIMIT 20;
    117175}}}
     176
     177{{{
     178cpu_per_build =
     179π_{b.id → build_id,
     180   c.name → cpu_model,
     181   cpu.cores,
     182   cpu.base_clock
     183} (
     184  σ_{c.type = 'CPU'} (
     185    (((build b
     186      ⋈_{b.id = bc.build_id} build_component bc)
     187      ⋈_{bc.component_id = c.id} components c)
     188      ⋈_{c.id = cpu.component_id} cpu)
     189  )
     190)
     191
     192gpu_per_build =
     193π_{b.id → build_id,
     194   c.name → gpu_model,
     195   gpu.vram
     196} (
     197  σ_{c.type = 'GPU'} (
     198    (((build b
     199      ⋈_{b.id = bc.build_id} build_component bc)
     200      ⋈_{bc.component_id = c.id} components c)
     201      ⋈_{c.id = gpu.component_id} gpu)
     202  )
     203)
     204
     205λ_20 (
     206  τ_{price_to_performance_index DESC} (
     207    π_{b.name → build_name,
     208      cpu.cpu_model,
     209      gpu.gpu_model,
     210      b.total_price,
     211      (cpu.cores * cpu.base_clock + gpu.vram * 100) → performance_score,
     212      ROUND((cpu.cores * cpu.base_clock + gpu.vram * 100), 4) → price_to_performance_index
     213    } (
     214      σ_{b.total_price > 0} (
     215        ((build b
     216          ⋈_{b.id = cpu.build_id} cpu_per_build cpu)
     217          ⋈_{b.id = gpu.build_id} gpu_per_build gpu)
     218      )
     219    )
     220  )
     221)
     222}}}