<commit_before>module Models.Page exposing (..)

import Http exposing (get, send)
import Models.Actions exposing (..)
import Models.Review as PageReview


type alias Model =
    { pageType : PageType
    , team : Maybe Team
    , reviewData : Maybe PageReview.Model
    , error : Maybe String
    , updates : Input
    }


init : ( Model, Cmd Action )
init =
    ( { pageType = Review
      , team = Nothing
      , reviewData = Nothing
      , error = Nothing
      , updates = { name = "" }
      }
    , requestTeam
    )


update : Action -> Model -> ( Model, Cmd Action )
update action model =
    case action of
        SetPage Review ->
            ( { model | pageType = Review }, requestTeam )

        SetPage page ->
            ( setError model "Not found", Cmd.none )

        Idle ->
            ( model, Cmd.none )

        ReviewUpdateTeam (Ok team) ->
            let
                initData =
                    PageReview.init

                firstUser =
                    case List.head team.users of
                        Just user ->
                            user

                        Nothing ->
                            initData.user
            in
                ( { model
                    | team = Just { users = team.users, summary = summary team.users }
                    , reviewData = PageReview.updateUser (Just initData) firstUser
                  }
                , Cmd.none
                )
<commit_msg>Request user details on first selected.<commit_after>module Models.Page exposing (..)

import Http exposing (get, send)
import Models.Actions exposing (..)
import Models.Review as PageReview


type alias Model =
    { pageType : PageType
    , team : Maybe Team
    , reviewData : Maybe PageReview.Model
    , error : Maybe String
    , updates : Input
    }


init : ( Model, Cmd Action )
init =
    ( { pageType = Review
      , team = Nothing
      , reviewData = Nothing
      , error = Nothing
      , updates = { name = "" }
      }
    , requestTeam
    )


update : Action -> Model -> ( Model, Cmd Action )
update action model =
    case action of
        SetPage Review ->
            ( { model | pageType = Review }, requestTeam )

        SetPage page ->
            ( setError model "Not found", Cmd.none )

        Idle ->
            ( model, Cmd.none )

        ReviewUpdateTeam (Ok team) ->
            let
                initData =
                    PageReview.init

                firstUser =
                    case List.head team.users of
                        Just user ->
                            user

                        Nothing ->
                            initData.user
            in
                ( { model
                    | team = Just { users = team.users, summary = summary team.users }
                    , reviewData = PageReview.updateUser (Just initData) firstUser
                  }
                , requestUser firstUser.name
                )

{'fraction_non_alphanumeric': 0.08119946091644205, 'fraction_numerical': 0.0, 'mean_word_length': 1.2323308270676692, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2054588', 'n_tokens_mistral': 766, 'n_tokens_neox': 713, 'n_words': 218}